Merge pull request #61955 from brendandburns/deps

Automatic merge from submit-queue (batch tested with PRs 61096, 61955, 61542, 60597). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Rev the Azure SDK for networking.

```release-note
Rev the Azure SDK for networking to 2017-06-01
```
This commit is contained in:
Kubernetes Submit Queue 2018-04-02 15:35:06 -07:00 committed by GitHub
commit cb6453e7c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 19299 additions and 10621 deletions

178
Godeps/Godeps.json generated
View File

@ -46,11 +46,6 @@
"Comment": "v12.4.0-beta", "Comment": "v12.4.0-beta",
"Rev": "f111fc2fa3861c5fdced76cae4c9c71821969577" "Rev": "f111fc2fa3861c5fdced76cae4c9c71821969577"
}, },
{
"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/network",
"Comment": "v12.4.0-beta",
"Rev": "f111fc2fa3861c5fdced76cae4c9c71821969577"
},
{ {
"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/storage", "ImportPath": "github.com/Azure/azure-sdk-for-go/arm/storage",
"Comment": "v12.4.0-beta", "Comment": "v12.4.0-beta",
@ -61,6 +56,11 @@
"Comment": "v12.4.0-beta", "Comment": "v12.4.0-beta",
"Rev": "f111fc2fa3861c5fdced76cae4c9c71821969577" "Rev": "f111fc2fa3861c5fdced76cae4c9c71821969577"
}, },
{
"ImportPath": "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network",
"Comment": "v12.4.0-beta",
"Rev": "f111fc2fa3861c5fdced76cae4c9c71821969577"
},
{ {
"ImportPath": "github.com/Azure/azure-sdk-for-go/storage", "ImportPath": "github.com/Azure/azure-sdk-for-go/storage",
"Comment": "v12.4.0-beta", "Comment": "v12.4.0-beta",
@ -509,47 +509,47 @@
}, },
{ {
"ImportPath": "github.com/containerd/containerd/api/services/containers/v1", "ImportPath": "github.com/containerd/containerd/api/services/containers/v1",
"Comment": "v1.0.0-beta.2-159-g27d450a0", "Comment": "v1.0.0-beta.2-159-g27d450a",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084" "Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
}, },
{ {
"ImportPath": "github.com/containerd/containerd/api/services/tasks/v1", "ImportPath": "github.com/containerd/containerd/api/services/tasks/v1",
"Comment": "v1.0.0-beta.2-159-g27d450a0", "Comment": "v1.0.0-beta.2-159-g27d450a",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084" "Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
}, },
{ {
"ImportPath": "github.com/containerd/containerd/api/services/version/v1", "ImportPath": "github.com/containerd/containerd/api/services/version/v1",
"Comment": "v1.0.0-beta.2-159-g27d450a0", "Comment": "v1.0.0-beta.2-159-g27d450a",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084" "Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
}, },
{ {
"ImportPath": "github.com/containerd/containerd/api/types", "ImportPath": "github.com/containerd/containerd/api/types",
"Comment": "v1.0.0-beta.2-159-g27d450a0", "Comment": "v1.0.0-beta.2-159-g27d450a",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084" "Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
}, },
{ {
"ImportPath": "github.com/containerd/containerd/api/types/task", "ImportPath": "github.com/containerd/containerd/api/types/task",
"Comment": "v1.0.0-beta.2-159-g27d450a0", "Comment": "v1.0.0-beta.2-159-g27d450a",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084" "Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
}, },
{ {
"ImportPath": "github.com/containerd/containerd/containers", "ImportPath": "github.com/containerd/containerd/containers",
"Comment": "v1.0.0-beta.2-159-g27d450a0", "Comment": "v1.0.0-beta.2-159-g27d450a",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084" "Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
}, },
{ {
"ImportPath": "github.com/containerd/containerd/dialer", "ImportPath": "github.com/containerd/containerd/dialer",
"Comment": "v1.0.0-beta.2-159-g27d450a0", "Comment": "v1.0.0-beta.2-159-g27d450a",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084" "Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
}, },
{ {
"ImportPath": "github.com/containerd/containerd/errdefs", "ImportPath": "github.com/containerd/containerd/errdefs",
"Comment": "v1.0.0-beta.2-159-g27d450a0", "Comment": "v1.0.0-beta.2-159-g27d450a",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084" "Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
}, },
{ {
"ImportPath": "github.com/containerd/containerd/namespaces", "ImportPath": "github.com/containerd/containerd/namespaces",
"Comment": "v1.0.0-beta.2-159-g27d450a0", "Comment": "v1.0.0-beta.2-159-g27d450a",
"Rev": "27d450a01bb533d7ebc5701eb52792565396b084" "Rev": "27d450a01bb533d7ebc5701eb52792565396b084"
}, },
{ {
@ -1033,157 +1033,157 @@
}, },
{ {
"ImportPath": "github.com/docker/distribution/digestset", "ImportPath": "github.com/docker/distribution/digestset",
"Comment": "v2.6.0-rc.1-209-gedc3ab29", "Comment": "v2.6.0-rc.1-209-gedc3ab2",
"Rev": "edc3ab29cdff8694dd6feb85cfeb4b5f1b38ed9c" "Rev": "edc3ab29cdff8694dd6feb85cfeb4b5f1b38ed9c"
}, },
{ {
"ImportPath": "github.com/docker/distribution/reference", "ImportPath": "github.com/docker/distribution/reference",
"Comment": "v2.6.0-rc.1-209-gedc3ab29", "Comment": "v2.6.0-rc.1-209-gedc3ab2",
"Rev": "edc3ab29cdff8694dd6feb85cfeb4b5f1b38ed9c" "Rev": "edc3ab29cdff8694dd6feb85cfeb4b5f1b38ed9c"
}, },
{ {
"ImportPath": "github.com/docker/docker/api", "ImportPath": "github.com/docker/docker/api",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types", "ImportPath": "github.com/docker/docker/api/types",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/blkiodev", "ImportPath": "github.com/docker/docker/api/types/blkiodev",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/container", "ImportPath": "github.com/docker/docker/api/types/container",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/events", "ImportPath": "github.com/docker/docker/api/types/events",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/filters", "ImportPath": "github.com/docker/docker/api/types/filters",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/image", "ImportPath": "github.com/docker/docker/api/types/image",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/mount", "ImportPath": "github.com/docker/docker/api/types/mount",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/network", "ImportPath": "github.com/docker/docker/api/types/network",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/registry", "ImportPath": "github.com/docker/docker/api/types/registry",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/strslice", "ImportPath": "github.com/docker/docker/api/types/strslice",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/swarm", "ImportPath": "github.com/docker/docker/api/types/swarm",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/swarm/runtime", "ImportPath": "github.com/docker/docker/api/types/swarm/runtime",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/time", "ImportPath": "github.com/docker/docker/api/types/time",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/versions", "ImportPath": "github.com/docker/docker/api/types/versions",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/api/types/volume", "ImportPath": "github.com/docker/docker/api/types/volume",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/client", "ImportPath": "github.com/docker/docker/client",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/pkg/ioutils", "ImportPath": "github.com/docker/docker/pkg/ioutils",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/pkg/jsonlog", "ImportPath": "github.com/docker/docker/pkg/jsonlog",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/pkg/jsonmessage", "ImportPath": "github.com/docker/docker/pkg/jsonmessage",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/pkg/longpath", "ImportPath": "github.com/docker/docker/pkg/longpath",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/pkg/mount", "ImportPath": "github.com/docker/docker/pkg/mount",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/pkg/parsers", "ImportPath": "github.com/docker/docker/pkg/parsers",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/pkg/stdcopy", "ImportPath": "github.com/docker/docker/pkg/stdcopy",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/pkg/sysinfo", "ImportPath": "github.com/docker/docker/pkg/sysinfo",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/pkg/system", "ImportPath": "github.com/docker/docker/pkg/system",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/pkg/term", "ImportPath": "github.com/docker/docker/pkg/term",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/pkg/term/windows", "ImportPath": "github.com/docker/docker/pkg/term/windows",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
"ImportPath": "github.com/docker/docker/pkg/tlsconfig", "ImportPath": "github.com/docker/docker/pkg/tlsconfig",
"Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616fb1", "Comment": "docs-v1.12.0-rc4-2016-07-15-7401-g4f3616f",
"Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756" "Rev": "4f3616fb1c112e206b88cb7a9922bf49067a7756"
}, },
{ {
@ -1208,7 +1208,7 @@
}, },
{ {
"ImportPath": "github.com/docker/libnetwork/ipvs", "ImportPath": "github.com/docker/libnetwork/ipvs",
"Comment": "v0.8.0-dev.2-910-gba46b928", "Comment": "v0.8.0-dev.2-910-gba46b92",
"Rev": "ba46b928444931e6865d8618dc03622cac79aa6f" "Rev": "ba46b928444931e6865d8618dc03622cac79aa6f"
}, },
{ {
@ -1271,10 +1271,12 @@
}, },
{ {
"ImportPath": "github.com/garyburd/redigo/internal", "ImportPath": "github.com/garyburd/redigo/internal",
"Comment": "v1.0.0-1-gb8dc900",
"Rev": "b8dc90050f24c1a73a52f107f3f575be67b21b7c" "Rev": "b8dc90050f24c1a73a52f107f3f575be67b21b7c"
}, },
{ {
"ImportPath": "github.com/garyburd/redigo/redis", "ImportPath": "github.com/garyburd/redigo/redis",
"Comment": "v1.0.0-1-gb8dc900",
"Rev": "b8dc90050f24c1a73a52f107f3f575be67b21b7c" "Rev": "b8dc90050f24c1a73a52f107f3f575be67b21b7c"
}, },
{ {
@ -1333,132 +1335,132 @@
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/gogoproto", "ImportPath": "github.com/gogo/protobuf/gogoproto",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/compare", "ImportPath": "github.com/gogo/protobuf/plugin/compare",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/defaultcheck", "ImportPath": "github.com/gogo/protobuf/plugin/defaultcheck",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/description", "ImportPath": "github.com/gogo/protobuf/plugin/description",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/embedcheck", "ImportPath": "github.com/gogo/protobuf/plugin/embedcheck",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/enumstringer", "ImportPath": "github.com/gogo/protobuf/plugin/enumstringer",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/equal", "ImportPath": "github.com/gogo/protobuf/plugin/equal",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/face", "ImportPath": "github.com/gogo/protobuf/plugin/face",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/gostring", "ImportPath": "github.com/gogo/protobuf/plugin/gostring",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/marshalto", "ImportPath": "github.com/gogo/protobuf/plugin/marshalto",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/oneofcheck", "ImportPath": "github.com/gogo/protobuf/plugin/oneofcheck",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/populate", "ImportPath": "github.com/gogo/protobuf/plugin/populate",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/size", "ImportPath": "github.com/gogo/protobuf/plugin/size",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/stringer", "ImportPath": "github.com/gogo/protobuf/plugin/stringer",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/testgen", "ImportPath": "github.com/gogo/protobuf/plugin/testgen",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/union", "ImportPath": "github.com/gogo/protobuf/plugin/union",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/plugin/unmarshal", "ImportPath": "github.com/gogo/protobuf/plugin/unmarshal",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/proto", "ImportPath": "github.com/gogo/protobuf/proto",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/descriptor", "ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/descriptor",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/generator", "ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/generator",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/grpc", "ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/grpc",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/plugin", "ImportPath": "github.com/gogo/protobuf/protoc-gen-gogo/plugin",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/sortkeys", "ImportPath": "github.com/gogo/protobuf/sortkeys",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/types", "ImportPath": "github.com/gogo/protobuf/types",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/vanity", "ImportPath": "github.com/gogo/protobuf/vanity",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
"ImportPath": "github.com/gogo/protobuf/vanity/command", "ImportPath": "github.com/gogo/protobuf/vanity/command",
"Comment": "v0.4-3-gc0656edd", "Comment": "v0.4-3-gc0656ed",
"Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7" "Rev": "c0656edd0d9eab7c66d1eb0c568f9039345796f7"
}, },
{ {
@ -2402,82 +2404,82 @@
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer", "ImportPath": "github.com/opencontainers/runc/libcontainer",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/apparmor", "ImportPath": "github.com/opencontainers/runc/libcontainer/apparmor",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/cgroups", "ImportPath": "github.com/opencontainers/runc/libcontainer/cgroups",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/cgroups/fs", "ImportPath": "github.com/opencontainers/runc/libcontainer/cgroups/fs",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/cgroups/systemd", "ImportPath": "github.com/opencontainers/runc/libcontainer/cgroups/systemd",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/configs", "ImportPath": "github.com/opencontainers/runc/libcontainer/configs",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/configs/validate", "ImportPath": "github.com/opencontainers/runc/libcontainer/configs/validate",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/criurpc", "ImportPath": "github.com/opencontainers/runc/libcontainer/criurpc",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/intelrdt", "ImportPath": "github.com/opencontainers/runc/libcontainer/intelrdt",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/keys", "ImportPath": "github.com/opencontainers/runc/libcontainer/keys",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/mount", "ImportPath": "github.com/opencontainers/runc/libcontainer/mount",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/seccomp", "ImportPath": "github.com/opencontainers/runc/libcontainer/seccomp",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/stacktrace", "ImportPath": "github.com/opencontainers/runc/libcontainer/stacktrace",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/system", "ImportPath": "github.com/opencontainers/runc/libcontainer/system",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/user", "ImportPath": "github.com/opencontainers/runc/libcontainer/user",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {
"ImportPath": "github.com/opencontainers/runc/libcontainer/utils", "ImportPath": "github.com/opencontainers/runc/libcontainer/utils",
"Comment": "v1.0.0-rc4-221-g595bea02", "Comment": "v1.0.0-rc4-221-g595bea0",
"Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43" "Rev": "595bea022f077a9e17d7473b34fbaf1adaed9e43"
}, },
{ {

420
Godeps/LICENSES generated
View File

@ -8322,216 +8322,6 @@ SOFTWARE.
================================================================================ ================================================================================
================================================================================
= vendor/github.com/Azure/azure-sdk-for-go/arm/network licensed under: =
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 2016 Microsoft Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
= vendor/github.com/Azure/azure-sdk-for-go/LICENSE cce6fd055830ca30ff78fdf077e870d6
================================================================================
================================================================================ ================================================================================
= vendor/github.com/Azure/azure-sdk-for-go/arm/storage licensed under: = = vendor/github.com/Azure/azure-sdk-for-go/arm/storage licensed under: =
@ -8952,6 +8742,216 @@ SOFTWARE.
================================================================================ ================================================================================
================================================================================
= vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network licensed under: =
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 2016 Microsoft Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
= vendor/github.com/Azure/azure-sdk-for-go/LICENSE cce6fd055830ca30ff78fdf077e870d6
================================================================================
================================================================================ ================================================================================
= vendor/github.com/Azure/azure-sdk-for-go/storage licensed under: = = vendor/github.com/Azure/azure-sdk-for-go/storage licensed under: =

View File

@ -44,9 +44,9 @@ go_library(
"//pkg/volume:go_default_library", "//pkg/volume:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/compute:go_default_library", "//vendor/github.com/Azure/azure-sdk-for-go/arm/compute:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/disk:go_default_library", "//vendor/github.com/Azure/azure-sdk-for-go/arm/disk:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/network:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/storage:go_default_library", "//vendor/github.com/Azure/azure-sdk-for-go/arm/storage:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute:go_default_library", "//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/storage:go_default_library", "//vendor/github.com/Azure/azure-sdk-for-go/storage:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/adal:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest/adal:go_default_library",
@ -90,9 +90,9 @@ go_test(
"//pkg/cloudprovider/providers/azure/auth:go_default_library", "//pkg/cloudprovider/providers/azure/auth:go_default_library",
"//pkg/kubelet/apis:go_default_library", "//pkg/kubelet/apis:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/compute:go_default_library", "//vendor/github.com/Azure/azure-sdk-for-go/arm/compute:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/network:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/storage:go_default_library", "//vendor/github.com/Azure/azure-sdk-for-go/arm/storage:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute:go_default_library", "//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute:go_default_library",
"//vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest:go_default_library",
"//vendor/github.com/Azure/go-autorest/autorest/to:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest/to:go_default_library",
"//vendor/github.com/stretchr/testify/assert:go_default_library", "//vendor/github.com/stretchr/testify/assert:go_default_library",

View File

@ -21,8 +21,8 @@ import (
"net/http" "net/http"
"github.com/Azure/azure-sdk-for-go/arm/compute" "github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/Azure/azure-sdk-for-go/arm/network"
computepreview "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute" computepreview "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/golang/glog" "github.com/golang/glog"
@ -168,16 +168,18 @@ func (az *Cloud) CreateOrUpdateLBWithRetry(lb network.LoadBalancer) error {
func (az *Cloud) ListLBWithRetry() ([]network.LoadBalancer, error) { func (az *Cloud) ListLBWithRetry() ([]network.LoadBalancer, error) {
allLBs := []network.LoadBalancer{} allLBs := []network.LoadBalancer{}
var result network.LoadBalancerListResult var result network.LoadBalancerListResult
var resultPage LoadBalancerListResultPage
err := wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) { err := wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) {
var retryErr error var retryErr error
result, retryErr = az.LoadBalancerClient.List(az.ResourceGroup) resultPage, retryErr = az.LoadBalancerClient.List(az.ResourceGroup)
if retryErr != nil { if retryErr != nil {
glog.Errorf("LoadBalancerClient.List(%v) - backoff: failure, will retry,err=%v", glog.Errorf("LoadBalancerClient.List(%v) - backoff: failure, will retry,err=%v",
az.ResourceGroup, az.ResourceGroup,
retryErr) retryErr)
return false, retryErr return false, retryErr
} }
result = resultPage.Response()
glog.V(2).Infof("LoadBalancerClient.List(%v) - backoff: success", az.ResourceGroup) glog.V(2).Infof("LoadBalancerClient.List(%v) - backoff: success", az.ResourceGroup)
return true, nil return true, nil
}) })
@ -194,13 +196,14 @@ func (az *Cloud) ListLBWithRetry() ([]network.LoadBalancer, error) {
if result.NextLink != nil { if result.NextLink != nil {
err := wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) { err := wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) {
var retryErr error var retryErr error
result, retryErr = az.LoadBalancerClient.ListNextResults(az.ResourceGroup, result) resultPage, retryErr = az.LoadBalancerClient.ListNextResults(az.ResourceGroup, resultPage)
if retryErr != nil { if retryErr != nil {
glog.Errorf("LoadBalancerClient.ListNextResults(%v) - backoff: failure, will retry,err=%v", glog.Errorf("LoadBalancerClient.ListNextResults(%v) - backoff: failure, will retry,err=%v",
az.ResourceGroup, az.ResourceGroup,
retryErr) retryErr)
return false, retryErr return false, retryErr
} }
result = resultPage.Response()
glog.V(2).Infof("LoadBalancerClient.ListNextResults(%v) - backoff: success", az.ResourceGroup) glog.V(2).Infof("LoadBalancerClient.ListNextResults(%v) - backoff: success", az.ResourceGroup)
return true, nil return true, nil
}) })
@ -218,15 +221,18 @@ func (az *Cloud) ListLBWithRetry() ([]network.LoadBalancer, error) {
func (az *Cloud) ListPIPWithRetry(pipResourceGroup string) ([]network.PublicIPAddress, error) { func (az *Cloud) ListPIPWithRetry(pipResourceGroup string) ([]network.PublicIPAddress, error) {
allPIPs := []network.PublicIPAddress{} allPIPs := []network.PublicIPAddress{}
var result network.PublicIPAddressListResult var result network.PublicIPAddressListResult
var resultPage PublicIPAddressListResultPage
err := wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) { err := wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) {
var retryErr error var retryErr error
result, retryErr = az.PublicIPAddressesClient.List(pipResourceGroup) resultPage, retryErr = az.PublicIPAddressesClient.List(pipResourceGroup)
if retryErr != nil { if retryErr != nil {
glog.Errorf("PublicIPAddressesClient.List(%v) - backoff: failure, will retry,err=%v", glog.Errorf("PublicIPAddressesClient.List(%v) - backoff: failure, will retry,err=%v",
pipResourceGroup, pipResourceGroup,
retryErr) retryErr)
return false, retryErr return false, retryErr
} }
result = resultPage.Response()
glog.V(2).Infof("PublicIPAddressesClient.List(%v) - backoff: success", pipResourceGroup) glog.V(2).Infof("PublicIPAddressesClient.List(%v) - backoff: success", pipResourceGroup)
return true, nil return true, nil
}) })
@ -243,13 +249,14 @@ func (az *Cloud) ListPIPWithRetry(pipResourceGroup string) ([]network.PublicIPAd
if result.NextLink != nil { if result.NextLink != nil {
err := wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) { err := wait.ExponentialBackoff(az.requestBackoff(), func() (bool, error) {
var retryErr error var retryErr error
result, retryErr = az.PublicIPAddressesClient.ListNextResults(az.ResourceGroup, result) resultPage, retryErr = az.PublicIPAddressesClient.ListNextResults(az.ResourceGroup, resultPage)
if retryErr != nil { if retryErr != nil {
glog.Errorf("PublicIPAddressesClient.ListNextResults(%v) - backoff: failure, will retry,err=%v", glog.Errorf("PublicIPAddressesClient.ListNextResults(%v) - backoff: failure, will retry,err=%v",
pipResourceGroup, pipResourceGroup,
retryErr) retryErr)
return false, retryErr return false, retryErr
} }
result = resultPage.Response()
glog.V(2).Infof("PublicIPAddressesClient.ListNextResults(%v) - backoff: success", pipResourceGroup) glog.V(2).Infof("PublicIPAddressesClient.ListNextResults(%v) - backoff: success", pipResourceGroup)
return true, nil return true, nil
}) })

View File

@ -24,9 +24,9 @@ import (
"github.com/Azure/azure-sdk-for-go/arm/compute" "github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/Azure/azure-sdk-for-go/arm/disk" "github.com/Azure/azure-sdk-for-go/arm/disk"
"github.com/Azure/azure-sdk-for-go/arm/network"
"github.com/Azure/azure-sdk-for-go/arm/storage" "github.com/Azure/azure-sdk-for-go/arm/storage"
computepreview "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute" computepreview "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/adal" "github.com/Azure/go-autorest/autorest/adal"
"github.com/golang/glog" "github.com/golang/glog"
@ -50,6 +50,38 @@ func createARMRateLimitErrChannel(isWrite bool, opName string) chan error {
return errChan return errChan
} }
// LoadBalancerListResultPage is for faking.
type LoadBalancerListResultPage interface {
Next() error
NotDone() bool
Response() network.LoadBalancerListResult
Values() []network.LoadBalancer
}
// PublicIPAddressListResultPage is for faking.
type PublicIPAddressListResultPage interface {
Next() error
NotDone() bool
Response() network.PublicIPAddressListResult
Values() []network.PublicIPAddress
}
// SecurityGroupListResultPage is for faking.
type SecurityGroupListResultPage interface {
Next() error
NotDone() bool
Response() network.SecurityGroupListResult
Values() []network.SecurityGroup
}
// SubnetListResultPage is for faking.
type SubnetListResultPage interface {
Next() error
NotDone() bool
Response() network.SubnetListResult
Values() []network.Subnet
}
// VirtualMachinesClient defines needed functions for azure compute.VirtualMachinesClient // VirtualMachinesClient defines needed functions for azure compute.VirtualMachinesClient
type VirtualMachinesClient interface { type VirtualMachinesClient interface {
CreateOrUpdate(resourceGroupName string, VMName string, parameters compute.VirtualMachine, cancel <-chan struct{}) (<-chan compute.VirtualMachine, <-chan error) CreateOrUpdate(resourceGroupName string, VMName string, parameters compute.VirtualMachine, cancel <-chan struct{}) (<-chan compute.VirtualMachine, <-chan error)
@ -70,8 +102,8 @@ type LoadBalancersClient interface {
CreateOrUpdate(resourceGroupName string, loadBalancerName string, parameters network.LoadBalancer, cancel <-chan struct{}) (<-chan network.LoadBalancer, <-chan error) CreateOrUpdate(resourceGroupName string, loadBalancerName string, parameters network.LoadBalancer, cancel <-chan struct{}) (<-chan network.LoadBalancer, <-chan error)
Delete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) Delete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
Get(resourceGroupName string, loadBalancerName string, expand string) (result network.LoadBalancer, err error) Get(resourceGroupName string, loadBalancerName string, expand string) (result network.LoadBalancer, err error)
List(resourceGroupName string) (result network.LoadBalancerListResult, err error) List(resourceGroupName string) (result LoadBalancerListResultPage, err error)
ListNextResults(resourceGroupName string, lastResult network.LoadBalancerListResult) (result network.LoadBalancerListResult, err error) ListNextResults(resourceGroupName string, lastResult LoadBalancerListResultPage) (result LoadBalancerListResultPage, err error)
} }
// PublicIPAddressesClient defines needed functions for azure network.PublicIPAddressesClient // PublicIPAddressesClient defines needed functions for azure network.PublicIPAddressesClient
@ -79,8 +111,8 @@ type PublicIPAddressesClient interface {
CreateOrUpdate(resourceGroupName string, publicIPAddressName string, parameters network.PublicIPAddress, cancel <-chan struct{}) (<-chan network.PublicIPAddress, <-chan error) CreateOrUpdate(resourceGroupName string, publicIPAddressName string, parameters network.PublicIPAddress, cancel <-chan struct{}) (<-chan network.PublicIPAddress, <-chan error)
Delete(resourceGroupName string, publicIPAddressName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) Delete(resourceGroupName string, publicIPAddressName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
Get(resourceGroupName string, publicIPAddressName string, expand string) (result network.PublicIPAddress, err error) Get(resourceGroupName string, publicIPAddressName string, expand string) (result network.PublicIPAddress, err error)
List(resourceGroupName string) (result network.PublicIPAddressListResult, err error) List(resourceGroupName string) (result PublicIPAddressListResultPage, err error)
ListNextResults(resourceGroupName string, lastResults network.PublicIPAddressListResult) (result network.PublicIPAddressListResult, err error) ListNextResults(resourceGroupName string, lastResults PublicIPAddressListResultPage) (result PublicIPAddressListResultPage, err error)
} }
// SubnetsClient defines needed functions for azure network.SubnetsClient // SubnetsClient defines needed functions for azure network.SubnetsClient
@ -88,7 +120,7 @@ type SubnetsClient interface {
CreateOrUpdate(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters network.Subnet, cancel <-chan struct{}) (<-chan network.Subnet, <-chan error) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters network.Subnet, cancel <-chan struct{}) (<-chan network.Subnet, <-chan error)
Delete(resourceGroupName string, virtualNetworkName string, subnetName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) Delete(resourceGroupName string, virtualNetworkName string, subnetName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
Get(resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result network.Subnet, err error) Get(resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result network.Subnet, err error)
List(resourceGroupName string, virtualNetworkName string) (result network.SubnetListResult, err error) List(resourceGroupName string, virtualNetworkName string) (result SubnetListResultPage, err error)
} }
// SecurityGroupsClient defines needed functions for azure network.SecurityGroupsClient // SecurityGroupsClient defines needed functions for azure network.SecurityGroupsClient
@ -96,7 +128,7 @@ type SecurityGroupsClient interface {
CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, parameters network.SecurityGroup, cancel <-chan struct{}) (<-chan network.SecurityGroup, <-chan error) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, parameters network.SecurityGroup, cancel <-chan struct{}) (<-chan network.SecurityGroup, <-chan error)
Delete(resourceGroupName string, networkSecurityGroupName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) Delete(resourceGroupName string, networkSecurityGroupName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error)
Get(resourceGroupName string, networkSecurityGroupName string, expand string) (result network.SecurityGroup, err error) Get(resourceGroupName string, networkSecurityGroupName string, expand string) (result network.SecurityGroup, err error)
List(resourceGroupName string) (result network.SecurityGroupListResult, err error) List(resourceGroupName string) (result SecurityGroupListResultPage, err error)
} }
// VirtualMachineScaleSetsClient defines needed functions for azure computepreview.VirtualMachineScaleSetsClient // VirtualMachineScaleSetsClient defines needed functions for azure computepreview.VirtualMachineScaleSetsClient
@ -288,12 +320,27 @@ func (az *azInterfacesClient) CreateOrUpdate(resourceGroupName string, networkIn
glog.V(10).Infof("azInterfacesClient.CreateOrUpdate(%q,%q): end", resourceGroupName, networkInterfaceName) glog.V(10).Infof("azInterfacesClient.CreateOrUpdate(%q,%q): end", resourceGroupName, networkInterfaceName)
}() }()
ctx := context.TODO()
errChan := make(chan error, 1) errChan := make(chan error, 1)
resultChan := make(chan network.Interface, 1)
mc := newMetricContext("interfaces", "create_or_update", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("interfaces", "create_or_update", resourceGroupName, az.client.SubscriptionID)
resultChan, proxyErrChan := az.client.CreateOrUpdate(resourceGroupName, networkInterfaceName, parameters, cancel) future, err := az.client.CreateOrUpdate(ctx, resourceGroupName, networkInterfaceName, parameters)
err := <-proxyErrChan if err != nil {
mc.Observe(err) mc.Observe(err)
errChan <- err errChan <- err
return resultChan, errChan
}
go func() {
if err := future.WaitForCompletion(ctx, az.client.Client); err != nil {
mc.Observe(err)
errChan <- err
return
}
result, err := future.Result(az.client)
errChan <- err
resultChan <- result
}()
return resultChan, errChan return resultChan, errChan
} }
@ -309,7 +356,7 @@ func (az *azInterfacesClient) Get(resourceGroupName string, networkInterfaceName
}() }()
mc := newMetricContext("interfaces", "get", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("interfaces", "get", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.Get(resourceGroupName, networkInterfaceName, expand) result, err = az.client.Get(context.TODO(), resourceGroupName, networkInterfaceName, expand)
mc.Observe(err) mc.Observe(err)
return return
} }
@ -326,7 +373,7 @@ func (az *azInterfacesClient) GetVirtualMachineScaleSetNetworkInterface(resource
}() }()
mc := newMetricContext("interfaces", "get_vmss_ni", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("interfaces", "get_vmss_ni", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.GetVirtualMachineScaleSetNetworkInterface(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand) result, err = az.client.GetVirtualMachineScaleSetNetworkInterface(context.TODO(), resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, expand)
mc.Observe(err) mc.Observe(err)
return return
} }
@ -366,12 +413,27 @@ func (az *azLoadBalancersClient) CreateOrUpdate(resourceGroupName string, loadBa
glog.V(10).Infof("azLoadBalancersClient.CreateOrUpdate(%q,%q): end", resourceGroupName, loadBalancerName) glog.V(10).Infof("azLoadBalancersClient.CreateOrUpdate(%q,%q): end", resourceGroupName, loadBalancerName)
}() }()
ctx := context.TODO()
errChan := make(chan error, 1) errChan := make(chan error, 1)
resultChan := make(chan network.LoadBalancer, 1)
mc := newMetricContext("load_balancers", "create_or_update", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("load_balancers", "create_or_update", resourceGroupName, az.client.SubscriptionID)
resultChan, proxyErrChan := az.client.CreateOrUpdate(resourceGroupName, loadBalancerName, parameters, cancel) future, err := az.client.CreateOrUpdate(ctx, resourceGroupName, loadBalancerName, parameters)
err := <-proxyErrChan if err != nil {
mc.Observe(err) mc.Observe(err)
errChan <- err errChan <- err
return resultChan, errChan
}
go func() {
if err := future.WaitForCompletion(ctx, az.client.Client); err != nil {
mc.Observe(err)
errChan <- err
return
}
result, err := future.Result(az.client)
mc.Observe(err)
errChan <- err
resultChan <- result
}()
return resultChan, errChan return resultChan, errChan
} }
@ -389,12 +451,27 @@ func (az *azLoadBalancersClient) Delete(resourceGroupName string, loadBalancerNa
glog.V(10).Infof("azLoadBalancersClient.Delete(%q,%q): end", resourceGroupName, loadBalancerName) glog.V(10).Infof("azLoadBalancersClient.Delete(%q,%q): end", resourceGroupName, loadBalancerName)
}() }()
ctx := context.TODO()
errChan := make(chan error, 1) errChan := make(chan error, 1)
resultChan := make(chan autorest.Response, 1)
mc := newMetricContext("load_balancers", "delete", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("load_balancers", "delete", resourceGroupName, az.client.SubscriptionID)
resultChan, proxyErrChan := az.client.Delete(resourceGroupName, loadBalancerName, cancel) future, err := az.client.Delete(context.TODO(), resourceGroupName, loadBalancerName)
err := <-proxyErrChan if err != nil {
mc.Observe(err) mc.Observe(err)
errChan <- err errChan <- err
return resultChan, errChan
}
go func() {
if err := future.WaitForCompletion(ctx, az.client.Client); err != nil {
mc.Observe(err)
errChan <- err
return
}
result, err := future.Result(az.client)
mc.Observe(err)
errChan <- err
resultChan <- result
}()
return resultChan, errChan return resultChan, errChan
} }
@ -410,15 +487,15 @@ func (az *azLoadBalancersClient) Get(resourceGroupName string, loadBalancerName
}() }()
mc := newMetricContext("load_balancers", "get", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("load_balancers", "get", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.Get(resourceGroupName, loadBalancerName, expand) result, err = az.client.Get(context.TODO(), resourceGroupName, loadBalancerName, expand)
mc.Observe(err) mc.Observe(err)
return return
} }
func (az *azLoadBalancersClient) List(resourceGroupName string) (result network.LoadBalancerListResult, err error) { func (az *azLoadBalancersClient) List(resourceGroupName string) (LoadBalancerListResultPage, error) {
if !az.rateLimiterReader.TryAccept() { if !az.rateLimiterReader.TryAccept() {
err = createARMRateLimitErr(false, "LBList") err := createARMRateLimitErr(false, "LBList")
return return &network.LoadBalancerListResultPage{}, err
} }
glog.V(10).Infof("azLoadBalancersClient.List(%q): start", resourceGroupName) glog.V(10).Infof("azLoadBalancersClient.List(%q): start", resourceGroupName)
@ -427,12 +504,12 @@ func (az *azLoadBalancersClient) List(resourceGroupName string) (result network.
}() }()
mc := newMetricContext("load_balancers", "list", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("load_balancers", "list", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.List(resourceGroupName) result, err := az.client.List(context.TODO(), resourceGroupName)
mc.Observe(err) mc.Observe(err)
return return &result, err
} }
func (az *azLoadBalancersClient) ListNextResults(resourceGroupName string, lastResult network.LoadBalancerListResult) (result network.LoadBalancerListResult, err error) { func (az *azLoadBalancersClient) ListNextResults(resourceGroupName string, lastResult LoadBalancerListResultPage) (result LoadBalancerListResultPage, err error) {
if !az.rateLimiterReader.TryAccept() { if !az.rateLimiterReader.TryAccept() {
err = createARMRateLimitErr(false, "LBListNextResults") err = createARMRateLimitErr(false, "LBListNextResults")
return return
@ -444,9 +521,9 @@ func (az *azLoadBalancersClient) ListNextResults(resourceGroupName string, lastR
}() }()
mc := newMetricContext("load_balancers", "list_next_results", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("load_balancers", "list_next_results", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.ListNextResults(lastResult) err = lastResult.Next()
mc.Observe(err) mc.Observe(err)
return return lastResult, err
} }
// azPublicIPAddressesClient implements PublicIPAddressesClient. // azPublicIPAddressesClient implements PublicIPAddressesClient.
@ -484,12 +561,27 @@ func (az *azPublicIPAddressesClient) CreateOrUpdate(resourceGroupName string, pu
glog.V(10).Infof("azPublicIPAddressesClient.CreateOrUpdate(%q,%q): end", resourceGroupName, publicIPAddressName) glog.V(10).Infof("azPublicIPAddressesClient.CreateOrUpdate(%q,%q): end", resourceGroupName, publicIPAddressName)
}() }()
ctx := context.TODO()
errChan := make(chan error, 1) errChan := make(chan error, 1)
resultChan := make(chan network.PublicIPAddress, 1)
mc := newMetricContext("public_ip_addresses", "create_or_update", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("public_ip_addresses", "create_or_update", resourceGroupName, az.client.SubscriptionID)
resultChan, proxyErrChan := az.client.CreateOrUpdate(resourceGroupName, publicIPAddressName, parameters, cancel) future, err := az.client.CreateOrUpdate(context.TODO(), resourceGroupName, publicIPAddressName, parameters)
err := <-proxyErrChan if err != nil {
mc.Observe(err) mc.Observe(err)
errChan <- err errChan <- err
return resultChan, errChan
}
go func() {
if err := future.WaitForCompletion(ctx, az.client.Client); err != nil {
mc.Observe(err)
errChan <- err
return
}
result, err := future.Result(az.client)
mc.Observe(err)
errChan <- err
resultChan <- result
}()
return resultChan, errChan return resultChan, errChan
} }
@ -507,12 +599,27 @@ func (az *azPublicIPAddressesClient) Delete(resourceGroupName string, publicIPAd
glog.V(10).Infof("azPublicIPAddressesClient.Delete(%q,%q): end", resourceGroupName, publicIPAddressName) glog.V(10).Infof("azPublicIPAddressesClient.Delete(%q,%q): end", resourceGroupName, publicIPAddressName)
}() }()
ctx := context.TODO()
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1) errChan := make(chan error, 1)
mc := newMetricContext("public_ip_addresses", "delete", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("public_ip_addresses", "delete", resourceGroupName, az.client.SubscriptionID)
resultChan, proxyErrChan := az.client.Delete(resourceGroupName, publicIPAddressName, cancel) future, err := az.client.Delete(ctx, resourceGroupName, publicIPAddressName)
err := <-proxyErrChan if err != nil {
mc.Observe(err) mc.Observe(err)
errChan <- err errChan <- err
return resultChan, errChan
}
go func() {
if err := future.WaitForCompletion(ctx, az.client.Client); err != nil {
mc.Observe(err)
errChan <- err
return
}
result, err := future.Result(az.client)
mc.Observe(err)
errChan <- err
resultChan <- result
}()
return resultChan, errChan return resultChan, errChan
} }
@ -528,15 +635,15 @@ func (az *azPublicIPAddressesClient) Get(resourceGroupName string, publicIPAddre
}() }()
mc := newMetricContext("public_ip_addresses", "get", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("public_ip_addresses", "get", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.Get(resourceGroupName, publicIPAddressName, expand) ctx := context.TODO()
result, err = az.client.Get(ctx, resourceGroupName, publicIPAddressName, expand)
mc.Observe(err) mc.Observe(err)
return return
} }
func (az *azPublicIPAddressesClient) List(resourceGroupName string) (result network.PublicIPAddressListResult, err error) { func (az *azPublicIPAddressesClient) List(resourceGroupName string) (PublicIPAddressListResultPage, error) {
if !az.rateLimiterReader.TryAccept() { if !az.rateLimiterReader.TryAccept() {
err = createARMRateLimitErr(false, "PublicIPList") return nil, createARMRateLimitErr(false, "PublicIPList")
return
} }
glog.V(10).Infof("azPublicIPAddressesClient.List(%q): start", resourceGroupName) glog.V(10).Infof("azPublicIPAddressesClient.List(%q): start", resourceGroupName)
@ -545,12 +652,13 @@ func (az *azPublicIPAddressesClient) List(resourceGroupName string) (result netw
}() }()
mc := newMetricContext("public_ip_addresses", "list", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("public_ip_addresses", "list", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.List(resourceGroupName) ctx := context.TODO()
result, err := az.client.List(ctx, resourceGroupName)
mc.Observe(err) mc.Observe(err)
return return &result, err
} }
func (az *azPublicIPAddressesClient) ListNextResults(resourceGroupName string, lastResults network.PublicIPAddressListResult) (result network.PublicIPAddressListResult, err error) { func (az *azPublicIPAddressesClient) ListNextResults(resourceGroupName string, lastResults PublicIPAddressListResultPage) (result PublicIPAddressListResultPage, err error) {
if !az.rateLimiterReader.TryAccept() { if !az.rateLimiterReader.TryAccept() {
err = createARMRateLimitErr(false, "PublicIPListNextResults") err = createARMRateLimitErr(false, "PublicIPListNextResults")
return return
@ -562,9 +670,9 @@ func (az *azPublicIPAddressesClient) ListNextResults(resourceGroupName string, l
}() }()
mc := newMetricContext("public_ip_addresses", "list_next_results", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("public_ip_addresses", "list_next_results", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.ListNextResults(lastResults) err = lastResults.Next()
mc.Observe(err) mc.Observe(err)
return return lastResults, err
} }
// azSubnetsClient implements SubnetsClient. // azSubnetsClient implements SubnetsClient.
@ -602,12 +710,27 @@ func (az *azSubnetsClient) CreateOrUpdate(resourceGroupName string, virtualNetwo
glog.V(10).Infof("azSubnetsClient.CreateOrUpdate(%q,%q,%q): end", resourceGroupName, virtualNetworkName, subnetName) glog.V(10).Infof("azSubnetsClient.CreateOrUpdate(%q,%q,%q): end", resourceGroupName, virtualNetworkName, subnetName)
}() }()
ctx := context.TODO()
resultChan := make(chan network.Subnet, 1)
errChan := make(chan error, 1) errChan := make(chan error, 1)
mc := newMetricContext("subnets", "create_or_update", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("subnets", "create_or_update", resourceGroupName, az.client.SubscriptionID)
resultChan, proxyErrChan := az.client.CreateOrUpdate(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, cancel) future, err := az.client.CreateOrUpdate(ctx, resourceGroupName, virtualNetworkName, subnetName, subnetParameters)
err := <-proxyErrChan if err != nil {
mc.Observe(err) mc.Observe(err)
errChan <- err errChan <- err
return resultChan, errChan
}
go func() {
if err := future.WaitForCompletion(ctx, az.client.Client); err != nil {
mc.Observe(err)
errChan <- err
return
}
result, err := future.Result(az.client)
mc.Observe(err)
errChan <- err
resultChan <- result
}()
return resultChan, errChan return resultChan, errChan
} }
@ -625,12 +748,27 @@ func (az *azSubnetsClient) Delete(resourceGroupName string, virtualNetworkName s
glog.V(10).Infof("azSubnetsClient.Delete(%q,%q,%q): end", resourceGroupName, virtualNetworkName, subnetName) glog.V(10).Infof("azSubnetsClient.Delete(%q,%q,%q): end", resourceGroupName, virtualNetworkName, subnetName)
}() }()
ctx := context.TODO()
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1) errChan := make(chan error, 1)
mc := newMetricContext("subnets", "delete", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("subnets", "delete", resourceGroupName, az.client.SubscriptionID)
resultChan, proxyErrChan := az.client.Delete(resourceGroupName, virtualNetworkName, subnetName, cancel) future, err := az.client.Delete(ctx, resourceGroupName, virtualNetworkName, subnetName)
err := <-proxyErrChan if err != nil {
mc.Observe(err) mc.Observe(err)
errChan <- err errChan <- err
return resultChan, errChan
}
go func() {
if err := future.WaitForCompletion(ctx, az.client.Client); err != nil {
mc.Observe(err)
errChan <- err
return
}
result, err := future.Result(az.client)
mc.Observe(err)
errChan <- err
resultChan <- result
}()
return resultChan, errChan return resultChan, errChan
} }
@ -646,15 +784,15 @@ func (az *azSubnetsClient) Get(resourceGroupName string, virtualNetworkName stri
}() }()
mc := newMetricContext("subnets", "get", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("subnets", "get", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.Get(resourceGroupName, virtualNetworkName, subnetName, expand) ctx := context.TODO()
result, err = az.client.Get(ctx, resourceGroupName, virtualNetworkName, subnetName, expand)
mc.Observe(err) mc.Observe(err)
return return
} }
func (az *azSubnetsClient) List(resourceGroupName string, virtualNetworkName string) (result network.SubnetListResult, err error) { func (az *azSubnetsClient) List(resourceGroupName string, virtualNetworkName string) (SubnetListResultPage, error) {
if !az.rateLimiterReader.TryAccept() { if !az.rateLimiterReader.TryAccept() {
err = createARMRateLimitErr(false, "SubnetList") return nil, createARMRateLimitErr(false, "SubnetList")
return
} }
glog.V(10).Infof("azSubnetsClient.List(%q,%q): start", resourceGroupName, virtualNetworkName) glog.V(10).Infof("azSubnetsClient.List(%q,%q): start", resourceGroupName, virtualNetworkName)
@ -663,9 +801,10 @@ func (az *azSubnetsClient) List(resourceGroupName string, virtualNetworkName str
}() }()
mc := newMetricContext("subnets", "list", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("subnets", "list", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.List(resourceGroupName, virtualNetworkName) ctx := context.TODO()
result, err := az.client.List(ctx, resourceGroupName, virtualNetworkName)
mc.Observe(err) mc.Observe(err)
return return &result, err
} }
// azSecurityGroupsClient implements SecurityGroupsClient. // azSecurityGroupsClient implements SecurityGroupsClient.
@ -703,12 +842,27 @@ func (az *azSecurityGroupsClient) CreateOrUpdate(resourceGroupName string, netwo
glog.V(10).Infof("azSecurityGroupsClient.CreateOrUpdate(%q,%q): end", resourceGroupName, networkSecurityGroupName) glog.V(10).Infof("azSecurityGroupsClient.CreateOrUpdate(%q,%q): end", resourceGroupName, networkSecurityGroupName)
}() }()
ctx := context.TODO()
resultChan := make(chan network.SecurityGroup, 1)
errChan := make(chan error, 1) errChan := make(chan error, 1)
mc := newMetricContext("security_groups", "create_or_update", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("security_groups", "create_or_update", resourceGroupName, az.client.SubscriptionID)
resultChan, proxyErrChan := az.client.CreateOrUpdate(resourceGroupName, networkSecurityGroupName, parameters, cancel) future, err := az.client.CreateOrUpdate(ctx, resourceGroupName, networkSecurityGroupName, parameters)
err := <-proxyErrChan if err != nil {
mc.Observe(err) mc.Observe(err)
errChan <- err errChan <- err
return resultChan, errChan
}
go func() {
if err := future.WaitForCompletion(ctx, az.client.Client); err != nil {
mc.Observe(err)
errChan <- err
return
}
result, err := future.Result(az.client)
mc.Observe(err)
errChan <- err
resultChan <- result
}()
return resultChan, errChan return resultChan, errChan
} }
@ -726,12 +880,27 @@ func (az *azSecurityGroupsClient) Delete(resourceGroupName string, networkSecuri
glog.V(10).Infof("azSecurityGroupsClient.Delete(%q,%q): end", resourceGroupName, networkSecurityGroupName) glog.V(10).Infof("azSecurityGroupsClient.Delete(%q,%q): end", resourceGroupName, networkSecurityGroupName)
}() }()
ctx := context.TODO()
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1) errChan := make(chan error, 1)
mc := newMetricContext("security_groups", "delete", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("security_groups", "delete", resourceGroupName, az.client.SubscriptionID)
resultChan, proxyErrChan := az.client.Delete(resourceGroupName, networkSecurityGroupName, cancel) future, err := az.client.Delete(ctx, resourceGroupName, networkSecurityGroupName)
err := <-proxyErrChan if err != nil {
mc.Observe(err) mc.Observe(err)
errChan <- err errChan <- err
return resultChan, errChan
}
go func() {
if err := future.WaitForCompletion(ctx, az.client.Client); err != nil {
mc.Observe(err)
errChan <- err
return
}
result, err := future.Result(az.client)
mc.Observe(err)
errChan <- err
resultChan <- result
}()
return resultChan, errChan return resultChan, errChan
} }
@ -747,15 +916,15 @@ func (az *azSecurityGroupsClient) Get(resourceGroupName string, networkSecurityG
}() }()
mc := newMetricContext("security_groups", "get", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("security_groups", "get", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.Get(resourceGroupName, networkSecurityGroupName, expand) ctx := context.TODO()
result, err = az.client.Get(ctx, resourceGroupName, networkSecurityGroupName, expand)
mc.Observe(err) mc.Observe(err)
return return
} }
func (az *azSecurityGroupsClient) List(resourceGroupName string) (result network.SecurityGroupListResult, err error) { func (az *azSecurityGroupsClient) List(resourceGroupName string) (SecurityGroupListResultPage, error) {
if !az.rateLimiterReader.TryAccept() { if !az.rateLimiterReader.TryAccept() {
err = createARMRateLimitErr(false, "NSGList") return nil, createARMRateLimitErr(false, "NSGList")
return
} }
glog.V(10).Infof("azSecurityGroupsClient.List(%q): start", resourceGroupName) glog.V(10).Infof("azSecurityGroupsClient.List(%q): start", resourceGroupName)
@ -764,9 +933,10 @@ func (az *azSecurityGroupsClient) List(resourceGroupName string) (result network
}() }()
mc := newMetricContext("security_groups", "list", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("security_groups", "list", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.List(resourceGroupName) ctx := context.TODO()
result, err := az.client.List(ctx, resourceGroupName)
mc.Observe(err) mc.Observe(err)
return return &result, err
} }
// azVirtualMachineScaleSetsClient implements VirtualMachineScaleSetsClient. // azVirtualMachineScaleSetsClient implements VirtualMachineScaleSetsClient.
@ -1028,12 +1198,27 @@ func (az *azRoutesClient) CreateOrUpdate(resourceGroupName string, routeTableNam
glog.V(10).Infof("azRoutesClient.CreateOrUpdate(%q,%q,%q): end", resourceGroupName, routeTableName, routeName) glog.V(10).Infof("azRoutesClient.CreateOrUpdate(%q,%q,%q): end", resourceGroupName, routeTableName, routeName)
}() }()
ctx := context.TODO()
resultChan := make(chan network.Route, 1)
errChan := make(chan error, 1) errChan := make(chan error, 1)
mc := newMetricContext("routes", "create_or_update", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("routes", "create_or_update", resourceGroupName, az.client.SubscriptionID)
resultChan, proxyErrChan := az.client.CreateOrUpdate(resourceGroupName, routeTableName, routeName, routeParameters, cancel) future, err := az.client.CreateOrUpdate(ctx, resourceGroupName, routeTableName, routeName, routeParameters)
err := <-proxyErrChan if err != nil {
mc.Observe(err) mc.Observe(err)
errChan <- err errChan <- err
return resultChan, errChan
}
go func() {
if err := future.WaitForCompletion(ctx, az.client.Client); err != nil {
mc.Observe(err)
errChan <- err
return
}
result, err := future.Result(az.client)
mc.Observe(err)
errChan <- err
resultChan <- result
}()
return resultChan, errChan return resultChan, errChan
} }
@ -1051,12 +1236,27 @@ func (az *azRoutesClient) Delete(resourceGroupName string, routeTableName string
glog.V(10).Infof("azRoutesClient.Delete(%q,%q,%q): end", resourceGroupName, routeTableName, routeName) glog.V(10).Infof("azRoutesClient.Delete(%q,%q,%q): end", resourceGroupName, routeTableName, routeName)
}() }()
ctx := context.TODO()
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1) errChan := make(chan error, 1)
mc := newMetricContext("routes", "delete", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("routes", "delete", resourceGroupName, az.client.SubscriptionID)
resultChan, proxyErrChan := az.client.Delete(resourceGroupName, routeTableName, routeName, cancel) future, err := az.client.Delete(ctx, resourceGroupName, routeTableName, routeName)
err := <-proxyErrChan if err != nil {
mc.Observe(err) mc.Observe(err)
errChan <- err errChan <- err
return resultChan, errChan
}
go func() {
if err := future.WaitForCompletion(ctx, az.client.Client); err != nil {
mc.Observe(err)
errChan <- err
return
}
result, err := future.Result(az.client)
mc.Observe(err)
errChan <- err
resultChan <- result
}()
return resultChan, errChan return resultChan, errChan
} }
@ -1095,12 +1295,27 @@ func (az *azRouteTablesClient) CreateOrUpdate(resourceGroupName string, routeTab
glog.V(10).Infof("azRouteTablesClient.CreateOrUpdate(%q,%q): end", resourceGroupName, routeTableName) glog.V(10).Infof("azRouteTablesClient.CreateOrUpdate(%q,%q): end", resourceGroupName, routeTableName)
}() }()
ctx := context.TODO()
resultChan := make(chan network.RouteTable, 1)
errChan := make(chan error, 1) errChan := make(chan error, 1)
mc := newMetricContext("route_tables", "create_or_update", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("route_tables", "create_or_update", resourceGroupName, az.client.SubscriptionID)
resultChan, proxyErrChan := az.client.CreateOrUpdate(resourceGroupName, routeTableName, parameters, cancel) future, err := az.client.CreateOrUpdate(ctx, resourceGroupName, routeTableName, parameters)
err := <-proxyErrChan if err != nil {
mc.Observe(err) mc.Observe(err)
errChan <- err errChan <- err
return resultChan, errChan
}
go func() {
if err := future.WaitForCompletion(ctx, az.client.Client); err != nil {
mc.Observe(err)
errChan <- err
return
}
result, err := future.Result(az.client)
mc.Observe(err)
errChan <- err
resultChan <- result
}()
return resultChan, errChan return resultChan, errChan
} }
@ -1116,7 +1331,8 @@ func (az *azRouteTablesClient) Get(resourceGroupName string, routeTableName stri
}() }()
mc := newMetricContext("route_tables", "get", resourceGroupName, az.client.SubscriptionID) mc := newMetricContext("route_tables", "get", resourceGroupName, az.client.SubscriptionID)
result, err = az.client.Get(resourceGroupName, routeTableName, expand) ctx := context.TODO()
result, err = az.client.Get(ctx, resourceGroupName, routeTableName, expand)
mc.Observe(err) mc.Observe(err)
return return
} }

View File

@ -31,9 +31,9 @@ import (
"github.com/Azure/azure-sdk-for-go/arm/compute" "github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/Azure/azure-sdk-for-go/arm/disk" "github.com/Azure/azure-sdk-for-go/arm/disk"
"github.com/Azure/azure-sdk-for-go/arm/network"
"github.com/Azure/azure-sdk-for-go/arm/storage" "github.com/Azure/azure-sdk-for-go/arm/storage"
computepreview "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute" computepreview "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
) )
@ -133,7 +133,28 @@ func (fLBC *fakeAzureLBClient) Get(resourceGroupName string, loadBalancerName st
} }
} }
func (fLBC *fakeAzureLBClient) List(resourceGroupName string) (result network.LoadBalancerListResult, err error) { type fakeLoadBalancerListResultPage struct {
next LoadBalancerListResultPage
value network.LoadBalancerListResult
values []network.LoadBalancer
err error
}
func (pg *fakeLoadBalancerListResultPage) Next() error {
return nil
}
func (pg *fakeLoadBalancerListResultPage) NotDone() bool {
return pg.next != nil
}
func (pg *fakeLoadBalancerListResultPage) Response() network.LoadBalancerListResult {
return pg.value
}
func (pg *fakeLoadBalancerListResultPage) Values() []network.LoadBalancer {
return pg.values
}
func (fLBC *fakeAzureLBClient) List(resourceGroupName string) (result LoadBalancerListResultPage, err error) {
fLBC.mutex.Lock() fLBC.mutex.Lock()
defer fLBC.mutex.Unlock() defer fLBC.mutex.Unlock()
var value []network.LoadBalancer var value []network.LoadBalancer
@ -142,23 +163,18 @@ func (fLBC *fakeAzureLBClient) List(resourceGroupName string) (result network.Lo
value = append(value, v) value = append(value, v)
} }
} }
result.Response.Response = &http.Response{ return &fakeLoadBalancerListResultPage{
StatusCode: http.StatusOK, value: network.LoadBalancerListResult{
} Value: &value,
result.NextLink = nil },
result.Value = &value values: value,
return result, nil }, nil
} }
func (fLBC *fakeAzureLBClient) ListNextResults(resourceGroupName string, lastResult network.LoadBalancerListResult) (result network.LoadBalancerListResult, err error) { func (fLBC *fakeAzureLBClient) ListNextResults(resourceGroupName string, lastResult LoadBalancerListResultPage) (result LoadBalancerListResultPage, err error) {
fLBC.mutex.Lock() fLBC.mutex.Lock()
defer fLBC.mutex.Unlock() defer fLBC.mutex.Unlock()
result.Response.Response = &http.Response{ return &fakeLoadBalancerListResultPage{}, nil
StatusCode: http.StatusOK,
}
result.NextLink = nil
result.Value = nil
return result, nil
} }
type fakeAzurePIPClient struct { type fakeAzurePIPClient struct {
@ -270,13 +286,34 @@ func (fAPC *fakeAzurePIPClient) Get(resourceGroupName string, publicIPAddressNam
} }
} }
func (fAPC *fakeAzurePIPClient) ListNextResults(resourceGroupName string, lastResults network.PublicIPAddressListResult) (result network.PublicIPAddressListResult, err error) { type fakePublicIPAddressListResultPage struct {
fAPC.mutex.Lock() next PublicIPAddressListResultPage
defer fAPC.mutex.Unlock() value network.PublicIPAddressListResult
return network.PublicIPAddressListResult{}, nil values []network.PublicIPAddress
err error
} }
func (fAPC *fakeAzurePIPClient) List(resourceGroupName string) (result network.PublicIPAddressListResult, err error) { func (pg *fakePublicIPAddressListResultPage) Next() error {
return nil
}
func (pg *fakePublicIPAddressListResultPage) NotDone() bool {
return pg.next != nil
}
func (pg *fakePublicIPAddressListResultPage) Response() network.PublicIPAddressListResult {
return pg.value
}
func (pg *fakePublicIPAddressListResultPage) Values() []network.PublicIPAddress {
return pg.values
}
func (fAPC *fakeAzurePIPClient) ListNextResults(resourceGroupName string, lastResults PublicIPAddressListResultPage) (result PublicIPAddressListResultPage, err error) {
fAPC.mutex.Lock()
defer fAPC.mutex.Unlock()
return &fakePublicIPAddressListResultPage{}, nil
}
func (fAPC *fakeAzurePIPClient) List(resourceGroupName string) (result PublicIPAddressListResultPage, err error) {
fAPC.mutex.Lock() fAPC.mutex.Lock()
defer fAPC.mutex.Unlock() defer fAPC.mutex.Unlock()
var value []network.PublicIPAddress var value []network.PublicIPAddress
@ -285,11 +322,12 @@ func (fAPC *fakeAzurePIPClient) List(resourceGroupName string) (result network.P
value = append(value, v) value = append(value, v)
} }
} }
result.Response.Response = &http.Response{ result = &fakePublicIPAddressListResultPage{
StatusCode: http.StatusOK, value: network.PublicIPAddressListResult{
Value: &value,
},
values: value,
} }
result.NextLink = nil
result.Value = &value
return result, nil return result, nil
} }
@ -509,7 +547,29 @@ func (fASC *fakeAzureSubnetsClient) Get(resourceGroupName string, virtualNetwork
Message: "Not such Subnet", Message: "Not such Subnet",
} }
} }
func (fASC *fakeAzureSubnetsClient) List(resourceGroupName string, virtualNetworkName string) (result network.SubnetListResult, err error) {
type fakeSubnetListResultPage struct {
next SubnetListResultPage
value network.SubnetListResult
values []network.Subnet
err error
}
func (pg *fakeSubnetListResultPage) Next() error {
return nil
}
func (pg *fakeSubnetListResultPage) NotDone() bool {
return pg.next != nil
}
func (pg *fakeSubnetListResultPage) Response() network.SubnetListResult {
return pg.value
}
func (pg *fakeSubnetListResultPage) Values() []network.Subnet {
return pg.values
}
func (fASC *fakeAzureSubnetsClient) List(resourceGroupName string, virtualNetworkName string) (result SubnetListResultPage, err error) {
fASC.mutex.Lock() fASC.mutex.Lock()
defer fASC.mutex.Unlock() defer fASC.mutex.Unlock()
rgVnet := strings.Join([]string{resourceGroupName, virtualNetworkName}, "AND") rgVnet := strings.Join([]string{resourceGroupName, virtualNetworkName}, "AND")
@ -519,12 +579,12 @@ func (fASC *fakeAzureSubnetsClient) List(resourceGroupName string, virtualNetwor
value = append(value, v) value = append(value, v)
} }
} }
result.Response.Response = &http.Response{ return &fakeSubnetListResultPage{
StatusCode: http.StatusOK, value: network.SubnetListResult{
} Value: &value,
result.NextLink = nil },
result.Value = &value values: value,
return result, nil }, nil
} }
type fakeAzureNSGClient struct { type fakeAzureNSGClient struct {
@ -611,7 +671,28 @@ func (fNSG *fakeAzureNSGClient) Get(resourceGroupName string, networkSecurityGro
} }
} }
func (fNSG *fakeAzureNSGClient) List(resourceGroupName string) (result network.SecurityGroupListResult, err error) { type fakeSecurityGroupListResultPage struct {
next SecurityGroupListResultPage
value network.SecurityGroupListResult
values []network.SecurityGroup
err error
}
func (pg *fakeSecurityGroupListResultPage) Next() error {
return nil
}
func (pg *fakeSecurityGroupListResultPage) NotDone() bool {
return pg.next != nil
}
func (pg *fakeSecurityGroupListResultPage) Response() network.SecurityGroupListResult {
return pg.value
}
func (pg *fakeSecurityGroupListResultPage) Values() []network.SecurityGroup {
return pg.values
}
func (fNSG *fakeAzureNSGClient) List(resourceGroupName string) (result SecurityGroupListResultPage, err error) {
fNSG.mutex.Lock() fNSG.mutex.Lock()
defer fNSG.mutex.Unlock() defer fNSG.mutex.Unlock()
var value []network.SecurityGroup var value []network.SecurityGroup
@ -620,11 +701,12 @@ func (fNSG *fakeAzureNSGClient) List(resourceGroupName string) (result network.S
value = append(value, v) value = append(value, v)
} }
} }
result.Response.Response = &http.Response{ result = &fakeSecurityGroupListResultPage{
StatusCode: http.StatusOK, value: network.SecurityGroupListResult{
Value: &value,
},
values: value,
} }
result.NextLink = nil
result.Value = &value
return result, nil return result, nil
} }

View File

@ -27,7 +27,7 @@ import (
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
serviceapi "k8s.io/kubernetes/pkg/api/v1/service" serviceapi "k8s.io/kubernetes/pkg/api/v1/service"
"github.com/Azure/azure-sdk-for-go/arm/network" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
"github.com/golang/glog" "github.com/golang/glog"
) )

View File

@ -20,7 +20,7 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/Azure/azure-sdk-for-go/arm/network" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )

View File

@ -22,7 +22,7 @@ import (
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
"github.com/Azure/azure-sdk-for-go/arm/network" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"

View File

@ -24,7 +24,7 @@ import (
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
"github.com/Azure/azure-sdk-for-go/arm/network" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
) )

View File

@ -29,7 +29,7 @@ import (
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
"github.com/Azure/azure-sdk-for-go/arm/compute" "github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/Azure/azure-sdk-for-go/arm/network" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"

View File

@ -36,7 +36,7 @@ import (
kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis" kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis"
"github.com/Azure/azure-sdk-for-go/arm/compute" "github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/Azure/azure-sdk-for-go/arm/network" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
@ -216,8 +216,8 @@ func testLoadBalancerServiceDefaultModeSelection(t *testing.T, isInternal bool)
} }
result, _ := az.LoadBalancerClient.List(az.Config.ResourceGroup) result, _ := az.LoadBalancerClient.List(az.Config.ResourceGroup)
lb := (*result.Value)[0] lb := result.Values()[0]
lbCount := len(*result.Value) lbCount := len(result.Values())
expectedNumOfLB := 1 expectedNumOfLB := 1
if lbCount != expectedNumOfLB { if lbCount != expectedNumOfLB {
t.Errorf("Unexpected number of LB's: Expected (%d) Found (%d)", expectedNumOfLB, lbCount) t.Errorf("Unexpected number of LB's: Expected (%d) Found (%d)", expectedNumOfLB, lbCount)
@ -266,14 +266,14 @@ func testLoadBalancerServiceAutoModeSelection(t *testing.T, isInternal bool) {
// expected is MIN(index, availabilitySetCount) // expected is MIN(index, availabilitySetCount)
expectedNumOfLB := int(math.Min(float64(index), float64(availabilitySetCount))) expectedNumOfLB := int(math.Min(float64(index), float64(availabilitySetCount)))
result, _ := az.LoadBalancerClient.List(az.Config.ResourceGroup) result, _ := az.LoadBalancerClient.List(az.Config.ResourceGroup)
lbCount := len(*result.Value) lbCount := len(result.Values())
if lbCount != expectedNumOfLB { if lbCount != expectedNumOfLB {
t.Errorf("Unexpected number of LB's: Expected (%d) Found (%d)", expectedNumOfLB, lbCount) t.Errorf("Unexpected number of LB's: Expected (%d) Found (%d)", expectedNumOfLB, lbCount)
} }
maxRules := 0 maxRules := 0
minRules := serviceCount minRules := serviceCount
for _, lb := range *result.Value { for _, lb := range result.Values() {
ruleCount := len(*lb.LoadBalancingRules) ruleCount := len(*lb.LoadBalancingRules)
if ruleCount < minRules { if ruleCount < minRules {
minRules = ruleCount minRules = ruleCount
@ -329,7 +329,7 @@ func testLoadBalancerServicesSpecifiedSelection(t *testing.T, isInternal bool) {
// expected is MIN(index, 2) // expected is MIN(index, 2)
expectedNumOfLB := int(math.Min(float64(index), float64(2))) expectedNumOfLB := int(math.Min(float64(index), float64(2)))
result, _ := az.LoadBalancerClient.List(az.Config.ResourceGroup) result, _ := az.LoadBalancerClient.List(az.Config.ResourceGroup)
lbCount := len(*result.Value) lbCount := len(result.Values())
if lbCount != expectedNumOfLB { if lbCount != expectedNumOfLB {
t.Errorf("Unexpected number of LB's: Expected (%d) Found (%d)", expectedNumOfLB, lbCount) t.Errorf("Unexpected number of LB's: Expected (%d) Found (%d)", expectedNumOfLB, lbCount)
} }
@ -367,7 +367,7 @@ func testLoadBalancerMaxRulesServices(t *testing.T, isInternal bool) {
// expected is MIN(index, az.Config.MaximumLoadBalancerRuleCount) // expected is MIN(index, az.Config.MaximumLoadBalancerRuleCount)
expectedNumOfLBRules := int(math.Min(float64(index), float64(az.Config.MaximumLoadBalancerRuleCount))) expectedNumOfLBRules := int(math.Min(float64(index), float64(az.Config.MaximumLoadBalancerRuleCount)))
result, _ := az.LoadBalancerClient.List(az.Config.ResourceGroup) result, _ := az.LoadBalancerClient.List(az.Config.ResourceGroup)
lbCount := len(*result.Value) lbCount := len(result.Values())
if lbCount != expectedNumOfLBRules { if lbCount != expectedNumOfLBRules {
t.Errorf("Unexpected number of LB's: Expected (%d) Found (%d)", expectedNumOfLBRules, lbCount) t.Errorf("Unexpected number of LB's: Expected (%d) Found (%d)", expectedNumOfLBRules, lbCount)
} }
@ -437,7 +437,7 @@ func testLoadBalancerServiceAutoModeDeleteSelection(t *testing.T, isInternal boo
// expected is MIN(index, availabilitySetCount) // expected is MIN(index, availabilitySetCount)
expectedNumOfLB := int(math.Min(float64(index), float64(availabilitySetCount))) expectedNumOfLB := int(math.Min(float64(index), float64(availabilitySetCount)))
result, _ := az.LoadBalancerClient.List(az.Config.ResourceGroup) result, _ := az.LoadBalancerClient.List(az.Config.ResourceGroup)
lbCount := len(*result.Value) lbCount := len(result.Values())
if lbCount != expectedNumOfLB { if lbCount != expectedNumOfLB {
t.Errorf("Unexpected number of LB's: Expected (%d) Found (%d)", expectedNumOfLB, lbCount) t.Errorf("Unexpected number of LB's: Expected (%d) Found (%d)", expectedNumOfLB, lbCount)
} }

View File

@ -18,7 +18,7 @@ package azure
import ( import (
"github.com/Azure/azure-sdk-for-go/arm/compute" "github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/Azure/azure-sdk-for-go/arm/network" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"

View File

@ -24,8 +24,8 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/Azure/azure-sdk-for-go/arm/network"
computepreview "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute" computepreview "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest/to" "github.com/Azure/go-autorest/autorest/to"
"github.com/golang/glog" "github.com/golang/glog"

View File

@ -23,7 +23,7 @@ import (
"time" "time"
"github.com/Azure/azure-sdk-for-go/arm/compute" "github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/Azure/azure-sdk-for-go/arm/network" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"

2
vendor/BUILD vendored
View File

@ -16,9 +16,9 @@ filegroup(
"//vendor/github.com/Azure/azure-sdk-for-go/arm/compute:all-srcs", "//vendor/github.com/Azure/azure-sdk-for-go/arm/compute:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry:all-srcs", "//vendor/github.com/Azure/azure-sdk-for-go/arm/containerregistry:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/disk:all-srcs", "//vendor/github.com/Azure/azure-sdk-for-go/arm/disk:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/network:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/arm/storage:all-srcs", "//vendor/github.com/Azure/azure-sdk-for-go/arm/storage:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute:all-srcs", "//vendor/github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2017-12-01/compute:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network:all-srcs",
"//vendor/github.com/Azure/azure-sdk-for-go/storage:all-srcs", "//vendor/github.com/Azure/azure-sdk-for-go/storage:all-srcs",
"//vendor/github.com/Azure/go-ansiterm:all-srcs", "//vendor/github.com/Azure/go-ansiterm:all-srcs",
"//vendor/github.com/Azure/go-autorest/autorest:all-srcs", "//vendor/github.com/Azure/go-autorest/autorest:all-srcs",

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@ go_library(
"loadbalancers.go", "loadbalancers.go",
"localnetworkgateways.go", "localnetworkgateways.go",
"models.go", "models.go",
"operations.go",
"packetcaptures.go", "packetcaptures.go",
"publicipaddresses.go", "publicipaddresses.go",
"routefilterrules.go", "routefilterrules.go",
@ -42,7 +43,7 @@ go_library(
"virtualnetworks.go", "virtualnetworks.go",
"watchers.go", "watchers.go",
], ],
importpath = "github.com/Azure/azure-sdk-for-go/arm/network", importpath = "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = [ deps = [
"//vendor/github.com/Azure/go-autorest/autorest:go_default_library", "//vendor/github.com/Azure/go-autorest/autorest:go_default_library",

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// ApplicationSecurityGroupsClient is the network Client // ApplicationSecurityGroupsClient is the network Client
type ApplicationSecurityGroupsClient struct { type ApplicationSecurityGroupsClient struct {
ManagementClient BaseClient
} }
// NewApplicationSecurityGroupsClient creates an instance of the ApplicationSecurityGroupsClient client. // NewApplicationSecurityGroupsClient creates an instance of the ApplicationSecurityGroupsClient client.
@ -38,49 +39,28 @@ func NewApplicationSecurityGroupsClientWithBaseURI(baseURI string, subscriptionI
return ApplicationSecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} return ApplicationSecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates an application security group. This method may poll for completion. Polling can be // CreateOrUpdate creates or updates an application security group.
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
// //
// resourceGroupName is the name of the resource group. applicationSecurityGroupName is the name of the application // resourceGroupName is the name of the resource group. applicationSecurityGroupName is the name of the application
// security group. parameters is parameters supplied to the create or update ApplicationSecurityGroup operation. // security group. parameters is parameters supplied to the create or update ApplicationSecurityGroup operation.
func (client ApplicationSecurityGroupsClient) CreateOrUpdate(resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup, cancel <-chan struct{}) (<-chan ApplicationSecurityGroup, <-chan error) { func (client ApplicationSecurityGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup) (result ApplicationSecurityGroupsCreateOrUpdateFuture, err error) {
resultChan := make(chan ApplicationSecurityGroup, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationSecurityGroupName, parameters)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request")
var err error return
var result ApplicationSecurityGroup }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, applicationSecurityGroupName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ApplicationSecurityGroupsClient) CreateOrUpdatePreparer(resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup, cancel <-chan struct{}) (*http.Request, error) { func (client ApplicationSecurityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string, parameters ApplicationSecurityGroup) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName), "applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -99,16 +79,22 @@ func (client ApplicationSecurityGroupsClient) CreateOrUpdatePreparer(resourceGro
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters),
autorest.WithJSON(parameters), autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ApplicationSecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client ApplicationSecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (future ApplicationSecurityGroupsCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -117,56 +103,35 @@ func (client ApplicationSecurityGroupsClient) CreateOrUpdateResponder(resp *http
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result), autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing()) autorest.ByClosing())
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return return
} }
// Delete deletes the specified application security group. This method may poll for completion. Polling can be // Delete deletes the specified application security group.
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
// //
// resourceGroupName is the name of the resource group. applicationSecurityGroupName is the name of the application // resourceGroupName is the name of the resource group. applicationSecurityGroupName is the name of the application
// security group. // security group.
func (client ApplicationSecurityGroupsClient) Delete(resourceGroupName string, applicationSecurityGroupName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client ApplicationSecurityGroupsClient) Delete(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (result ApplicationSecurityGroupsDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, applicationSecurityGroupName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, applicationSecurityGroupName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client ApplicationSecurityGroupsClient) DeletePreparer(resourceGroupName string, applicationSecurityGroupName string, cancel <-chan struct{}) (*http.Request, error) { func (client ApplicationSecurityGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName), "applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -183,16 +148,22 @@ func (client ApplicationSecurityGroupsClient) DeletePreparer(resourceGroupName s
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ApplicationSecurityGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client ApplicationSecurityGroupsClient) DeleteSender(req *http.Request) (future ApplicationSecurityGroupsDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -201,7 +172,7 @@ func (client ApplicationSecurityGroupsClient) DeleteResponder(resp *http.Respons
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -211,8 +182,8 @@ func (client ApplicationSecurityGroupsClient) DeleteResponder(resp *http.Respons
// //
// resourceGroupName is the name of the resource group. applicationSecurityGroupName is the name of the application // resourceGroupName is the name of the resource group. applicationSecurityGroupName is the name of the application
// security group. // security group.
func (client ApplicationSecurityGroupsClient) Get(resourceGroupName string, applicationSecurityGroupName string) (result ApplicationSecurityGroup, err error) { func (client ApplicationSecurityGroupsClient) Get(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (result ApplicationSecurityGroup, err error) {
req, err := client.GetPreparer(resourceGroupName, applicationSecurityGroupName) req, err := client.GetPreparer(ctx, resourceGroupName, applicationSecurityGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "Get", nil, "Failure preparing request")
return return
@ -234,7 +205,7 @@ func (client ApplicationSecurityGroupsClient) Get(resourceGroupName string, appl
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client ApplicationSecurityGroupsClient) GetPreparer(resourceGroupName string, applicationSecurityGroupName string) (*http.Request, error) { func (client ApplicationSecurityGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationSecurityGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName), "applicationSecurityGroupName": autorest.Encode("path", applicationSecurityGroupName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -251,14 +222,13 @@ func (client ApplicationSecurityGroupsClient) GetPreparer(resourceGroupName stri
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups/{applicationSecurityGroupName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ApplicationSecurityGroupsClient) GetSender(req *http.Request) (*http.Response, error) { func (client ApplicationSecurityGroupsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -278,8 +248,9 @@ func (client ApplicationSecurityGroupsClient) GetResponder(resp *http.Response)
// List gets all the application security groups in a resource group. // List gets all the application security groups in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client ApplicationSecurityGroupsClient) List(resourceGroupName string) (result ApplicationSecurityGroupListResult, err error) { func (client ApplicationSecurityGroupsClient) List(ctx context.Context, resourceGroupName string) (result ApplicationSecurityGroupListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", nil, "Failure preparing request")
return return
@ -287,12 +258,12 @@ func (client ApplicationSecurityGroupsClient) List(resourceGroupName string) (re
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.asglr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.asglr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", resp, "Failure responding to request")
} }
@ -301,7 +272,7 @@ func (client ApplicationSecurityGroupsClient) List(resourceGroupName string) (re
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client ApplicationSecurityGroupsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { func (client ApplicationSecurityGroupsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -317,14 +288,13 @@ func (client ApplicationSecurityGroupsClient) ListPreparer(resourceGroupName str
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationSecurityGroups", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ApplicationSecurityGroupsClient) ListSender(req *http.Request) (*http.Response, error) { func (client ApplicationSecurityGroupsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -341,78 +311,37 @@ func (client ApplicationSecurityGroupsClient) ListResponder(resp *http.Response)
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client ApplicationSecurityGroupsClient) ListNextResults(lastResults ApplicationSecurityGroupListResult) (result ApplicationSecurityGroupListResult, err error) { func (client ApplicationSecurityGroupsClient) listNextResults(lastResults ApplicationSecurityGroupListResult) (result ApplicationSecurityGroupListResult, err error) {
req, err := lastResults.ApplicationSecurityGroupListResultPreparer() req, err := lastResults.applicationSecurityGroupListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client ApplicationSecurityGroupsClient) ListComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan ApplicationSecurityGroup, <-chan error) { func (client ApplicationSecurityGroupsClient) ListComplete(ctx context.Context, resourceGroupName string) (result ApplicationSecurityGroupListResultIterator, err error) {
resultChan := make(chan ApplicationSecurityGroup) result.page, err = client.List(ctx, resourceGroupName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
// ListAll gets all application security groups in a subscription. // ListAll gets all application security groups in a subscription.
func (client ApplicationSecurityGroupsClient) ListAll() (result ApplicationSecurityGroupListResult, err error) { func (client ApplicationSecurityGroupsClient) ListAll(ctx context.Context) (result ApplicationSecurityGroupListResultPage, err error) {
req, err := client.ListAllPreparer() result.fn = client.listAllNextResults
req, err := client.ListAllPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", nil, "Failure preparing request")
return return
@ -420,12 +349,12 @@ func (client ApplicationSecurityGroupsClient) ListAll() (result ApplicationSecur
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.asglr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", resp, "Failure sending request")
return return
} }
result, err = client.ListAllResponder(resp) result.asglr, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", resp, "Failure responding to request")
} }
@ -434,7 +363,7 @@ func (client ApplicationSecurityGroupsClient) ListAll() (result ApplicationSecur
} }
// ListAllPreparer prepares the ListAll request. // ListAllPreparer prepares the ListAll request.
func (client ApplicationSecurityGroupsClient) ListAllPreparer() (*http.Request, error) { func (client ApplicationSecurityGroupsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
} }
@ -449,14 +378,13 @@ func (client ApplicationSecurityGroupsClient) ListAllPreparer() (*http.Request,
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationSecurityGroups", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListAllSender sends the ListAll request. The method will close the // ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ApplicationSecurityGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) { func (client ApplicationSecurityGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -473,71 +401,29 @@ func (client ApplicationSecurityGroupsClient) ListAllResponder(resp *http.Respon
return return
} }
// ListAllNextResults retrieves the next set of results, if any. // listAllNextResults retrieves the next set of results, if any.
func (client ApplicationSecurityGroupsClient) ListAllNextResults(lastResults ApplicationSecurityGroupListResult) (result ApplicationSecurityGroupListResult, err error) { func (client ApplicationSecurityGroupsClient) listAllNextResults(lastResults ApplicationSecurityGroupListResult) (result ApplicationSecurityGroupListResult, err error) {
req, err := lastResults.ApplicationSecurityGroupListResultPreparer() req, err := lastResults.applicationSecurityGroupListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listAllNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listAllNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "ListAll", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.ApplicationSecurityGroupsClient", "listAllNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListAllComplete gets all elements from the list without paging. // ListAllComplete enumerates all values, automatically crossing page boundaries as required.
func (client ApplicationSecurityGroupsClient) ListAllComplete(cancel <-chan struct{}) (<-chan ApplicationSecurityGroup, <-chan error) { func (client ApplicationSecurityGroupsClient) ListAllComplete(ctx context.Context) (result ApplicationSecurityGroupListResultIterator, err error) {
resultChan := make(chan ApplicationSecurityGroup) result.page, err = client.ListAll(ctx)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListAll()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListAllNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// AvailableEndpointServicesClient is the network Client // AvailableEndpointServicesClient is the network Client
type AvailableEndpointServicesClient struct { type AvailableEndpointServicesClient struct {
ManagementClient BaseClient
} }
// NewAvailableEndpointServicesClient creates an instance of the AvailableEndpointServicesClient client. // NewAvailableEndpointServicesClient creates an instance of the AvailableEndpointServicesClient client.
@ -41,8 +42,9 @@ func NewAvailableEndpointServicesClientWithBaseURI(baseURI string, subscriptionI
// List list what values of endpoint services are available for use. // List list what values of endpoint services are available for use.
// //
// location is the location to check available endpoint services. // location is the location to check available endpoint services.
func (client AvailableEndpointServicesClient) List(location string) (result EndpointServicesListResult, err error) { func (client AvailableEndpointServicesClient) List(ctx context.Context, location string) (result EndpointServicesListResultPage, err error) {
req, err := client.ListPreparer(location) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, location)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", nil, "Failure preparing request")
return return
@ -50,12 +52,12 @@ func (client AvailableEndpointServicesClient) List(location string) (result Endp
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.eslr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.eslr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", resp, "Failure responding to request")
} }
@ -64,7 +66,7 @@ func (client AvailableEndpointServicesClient) List(location string) (result Endp
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client AvailableEndpointServicesClient) ListPreparer(location string) (*http.Request, error) { func (client AvailableEndpointServicesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"location": autorest.Encode("path", location), "location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -80,14 +82,13 @@ func (client AvailableEndpointServicesClient) ListPreparer(location string) (*ht
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/virtualNetworkAvailableEndpointServices", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client AvailableEndpointServicesClient) ListSender(req *http.Request) (*http.Response, error) { func (client AvailableEndpointServicesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -104,71 +105,29 @@ func (client AvailableEndpointServicesClient) ListResponder(resp *http.Response)
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client AvailableEndpointServicesClient) ListNextResults(lastResults EndpointServicesListResult) (result EndpointServicesListResult, err error) { func (client AvailableEndpointServicesClient) listNextResults(lastResults EndpointServicesListResult) (result EndpointServicesListResult, err error) {
req, err := lastResults.EndpointServicesListResultPreparer() req, err := lastResults.endpointServicesListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.AvailableEndpointServicesClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client AvailableEndpointServicesClient) ListComplete(location string, cancel <-chan struct{}) (<-chan EndpointServiceResult, <-chan error) { func (client AvailableEndpointServicesClient) ListComplete(ctx context.Context, location string) (result EndpointServicesListResultIterator, err error) {
resultChan := make(chan EndpointServiceResult) result.page, err = client.List(ctx, location)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(location)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// BgpServiceCommunitiesClient is the network Client // BgpServiceCommunitiesClient is the network Client
type BgpServiceCommunitiesClient struct { type BgpServiceCommunitiesClient struct {
ManagementClient BaseClient
} }
// NewBgpServiceCommunitiesClient creates an instance of the BgpServiceCommunitiesClient client. // NewBgpServiceCommunitiesClient creates an instance of the BgpServiceCommunitiesClient client.
@ -39,8 +40,9 @@ func NewBgpServiceCommunitiesClientWithBaseURI(baseURI string, subscriptionID st
} }
// List gets all the available bgp service communities. // List gets all the available bgp service communities.
func (client BgpServiceCommunitiesClient) List() (result BgpServiceCommunityListResult, err error) { func (client BgpServiceCommunitiesClient) List(ctx context.Context) (result BgpServiceCommunityListResultPage, err error) {
req, err := client.ListPreparer() result.fn = client.listNextResults
req, err := client.ListPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", nil, "Failure preparing request")
return return
@ -48,12 +50,12 @@ func (client BgpServiceCommunitiesClient) List() (result BgpServiceCommunityList
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.bsclr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.bsclr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure responding to request")
} }
@ -62,7 +64,7 @@ func (client BgpServiceCommunitiesClient) List() (result BgpServiceCommunityList
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client BgpServiceCommunitiesClient) ListPreparer() (*http.Request, error) { func (client BgpServiceCommunitiesClient) ListPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
} }
@ -77,14 +79,13 @@ func (client BgpServiceCommunitiesClient) ListPreparer() (*http.Request, error)
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/bgpServiceCommunities", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client BgpServiceCommunitiesClient) ListSender(req *http.Request) (*http.Response, error) { func (client BgpServiceCommunitiesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -101,71 +102,29 @@ func (client BgpServiceCommunitiesClient) ListResponder(resp *http.Response) (re
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client BgpServiceCommunitiesClient) ListNextResults(lastResults BgpServiceCommunityListResult) (result BgpServiceCommunityListResult, err error) { func (client BgpServiceCommunitiesClient) listNextResults(lastResults BgpServiceCommunityListResult) (result BgpServiceCommunityListResult, err error) {
req, err := lastResults.BgpServiceCommunityListResultPreparer() req, err := lastResults.bgpServiceCommunityListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.BgpServiceCommunitiesClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client BgpServiceCommunitiesClient) ListComplete(cancel <-chan struct{}) (<-chan BgpServiceCommunity, <-chan error) { func (client BgpServiceCommunitiesClient) ListComplete(ctx context.Context) (result BgpServiceCommunityListResultIterator, err error) {
resultChan := make(chan BgpServiceCommunity) result.page, err = client.List(ctx)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -1,8 +1,6 @@
// Package network implements the Azure ARM Network service API version . // Package network implements the Azure ARM Network service API version .
// //
// Network Client // Network Client
//
// Deprecated: Please instead use github.com/Azure/azure-sdk-for-go/services/network/mgmt/2017-09-01/network
package network package network
// Copyright (c) Microsoft and contributors. All rights reserved. // Copyright (c) Microsoft and contributors. All rights reserved.
@ -23,6 +21,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -33,21 +32,21 @@ const (
DefaultBaseURI = "https://management.azure.com" DefaultBaseURI = "https://management.azure.com"
) )
// ManagementClient is the base client for Network. // BaseClient is the base client for Network.
type ManagementClient struct { type BaseClient struct {
autorest.Client autorest.Client
BaseURI string BaseURI string
SubscriptionID string SubscriptionID string
} }
// New creates an instance of the ManagementClient client. // New creates an instance of the BaseClient client.
func New(subscriptionID string) ManagementClient { func New(subscriptionID string) BaseClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID) return NewWithBaseURI(DefaultBaseURI, subscriptionID)
} }
// NewWithBaseURI creates an instance of the ManagementClient client. // NewWithBaseURI creates an instance of the BaseClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient { func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
return ManagementClient{ return BaseClient{
Client: autorest.NewClientWithUserAgent(UserAgent()), Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI, BaseURI: baseURI,
SubscriptionID: subscriptionID, SubscriptionID: subscriptionID,
@ -58,30 +57,30 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
// //
// location is the location of the domain name. domainNameLabel is the domain name to be verified. It must conform to // location is the location of the domain name. domainNameLabel is the domain name to be verified. It must conform to
// the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$. // the following regular expression: ^[a-z][a-z0-9-]{1,61}[a-z0-9]$.
func (client ManagementClient) CheckDNSNameAvailability(location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) { func (client BaseClient) CheckDNSNameAvailability(ctx context.Context, location string, domainNameLabel string) (result DNSNameAvailabilityResult, err error) {
req, err := client.CheckDNSNameAvailabilityPreparer(location, domainNameLabel) req, err := client.CheckDNSNameAvailabilityPreparer(ctx, location, domainNameLabel)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", nil, "Failure preparing request")
return return
} }
resp, err := client.CheckDNSNameAvailabilitySender(req) resp, err := client.CheckDNSNameAvailabilitySender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", resp, "Failure sending request")
return return
} }
result, err = client.CheckDNSNameAvailabilityResponder(resp) result, err = client.CheckDNSNameAvailabilityResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ManagementClient", "CheckDNSNameAvailability", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.BaseClient", "CheckDNSNameAvailability", resp, "Failure responding to request")
} }
return return
} }
// CheckDNSNameAvailabilityPreparer prepares the CheckDNSNameAvailability request. // CheckDNSNameAvailabilityPreparer prepares the CheckDNSNameAvailability request.
func (client ManagementClient) CheckDNSNameAvailabilityPreparer(location string, domainNameLabel string) (*http.Request, error) { func (client BaseClient) CheckDNSNameAvailabilityPreparer(ctx context.Context, location string, domainNameLabel string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"location": autorest.Encode("path", location), "location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -98,20 +97,19 @@ func (client ManagementClient) CheckDNSNameAvailabilityPreparer(location string,
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CheckDNSNameAvailabilitySender sends the CheckDNSNameAvailability request. The method will close the // CheckDNSNameAvailabilitySender sends the CheckDNSNameAvailability request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ManagementClient) CheckDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) { func (client BaseClient) CheckDNSNameAvailabilitySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
// CheckDNSNameAvailabilityResponder handles the response to the CheckDNSNameAvailability request. The method always // CheckDNSNameAvailabilityResponder handles the response to the CheckDNSNameAvailability request. The method always
// closes the http.Response Body. // closes the http.Response Body.
func (client ManagementClient) CheckDNSNameAvailabilityResponder(resp *http.Response) (result DNSNameAvailabilityResult, err error) { func (client BaseClient) CheckDNSNameAvailabilityResponder(resp *http.Response) (result DNSNameAvailabilityResult, err error) {
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// DefaultSecurityRulesClient is the network Client // DefaultSecurityRulesClient is the network Client
type DefaultSecurityRulesClient struct { type DefaultSecurityRulesClient struct {
ManagementClient BaseClient
} }
// NewDefaultSecurityRulesClient creates an instance of the DefaultSecurityRulesClient client. // NewDefaultSecurityRulesClient creates an instance of the DefaultSecurityRulesClient client.
@ -42,8 +43,8 @@ func NewDefaultSecurityRulesClientWithBaseURI(baseURI string, subscriptionID str
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security
// group. defaultSecurityRuleName is the name of the default security rule. // group. defaultSecurityRuleName is the name of the default security rule.
func (client DefaultSecurityRulesClient) Get(resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string) (result SecurityRule, err error) { func (client DefaultSecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string) (result SecurityRule, err error) {
req, err := client.GetPreparer(resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName) req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, defaultSecurityRuleName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "Get", nil, "Failure preparing request")
return return
@ -65,7 +66,7 @@ func (client DefaultSecurityRulesClient) Get(resourceGroupName string, networkSe
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client DefaultSecurityRulesClient) GetPreparer(resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string) (*http.Request, error) { func (client DefaultSecurityRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, defaultSecurityRuleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"defaultSecurityRuleName": autorest.Encode("path", defaultSecurityRuleName), "defaultSecurityRuleName": autorest.Encode("path", defaultSecurityRuleName),
"networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName),
@ -83,14 +84,13 @@ func (client DefaultSecurityRulesClient) GetPreparer(resourceGroupName string, n
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules/{defaultSecurityRuleName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client DefaultSecurityRulesClient) GetSender(req *http.Request) (*http.Response, error) { func (client DefaultSecurityRulesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -111,8 +111,9 @@ func (client DefaultSecurityRulesClient) GetResponder(resp *http.Response) (resu
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security
// group. // group.
func (client DefaultSecurityRulesClient) List(resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResult, err error) { func (client DefaultSecurityRulesClient) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, networkSecurityGroupName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, networkSecurityGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", nil, "Failure preparing request")
return return
@ -120,12 +121,12 @@ func (client DefaultSecurityRulesClient) List(resourceGroupName string, networkS
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.srlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.srlr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", resp, "Failure responding to request")
} }
@ -134,7 +135,7 @@ func (client DefaultSecurityRulesClient) List(resourceGroupName string, networkS
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client DefaultSecurityRulesClient) ListPreparer(resourceGroupName string, networkSecurityGroupName string) (*http.Request, error) { func (client DefaultSecurityRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -151,14 +152,13 @@ func (client DefaultSecurityRulesClient) ListPreparer(resourceGroupName string,
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/defaultSecurityRules", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client DefaultSecurityRulesClient) ListSender(req *http.Request) (*http.Response, error) { func (client DefaultSecurityRulesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -175,71 +175,29 @@ func (client DefaultSecurityRulesClient) ListResponder(resp *http.Response) (res
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client DefaultSecurityRulesClient) ListNextResults(lastResults SecurityRuleListResult) (result SecurityRuleListResult, err error) { func (client DefaultSecurityRulesClient) listNextResults(lastResults SecurityRuleListResult) (result SecurityRuleListResult, err error) {
req, err := lastResults.SecurityRuleListResultPreparer() req, err := lastResults.securityRuleListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.DefaultSecurityRulesClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client DefaultSecurityRulesClient) ListComplete(resourceGroupName string, networkSecurityGroupName string, cancel <-chan struct{}) (<-chan SecurityRule, <-chan error) { func (client DefaultSecurityRulesClient) ListComplete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultIterator, err error) {
resultChan := make(chan SecurityRule) result.page, err = client.List(ctx, resourceGroupName, networkSecurityGroupName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, networkSecurityGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// ExpressRouteCircuitAuthorizationsClient is the network Client // ExpressRouteCircuitAuthorizationsClient is the network Client
type ExpressRouteCircuitAuthorizationsClient struct { type ExpressRouteCircuitAuthorizationsClient struct {
ManagementClient BaseClient
} }
// NewExpressRouteCircuitAuthorizationsClient creates an instance of the ExpressRouteCircuitAuthorizationsClient // NewExpressRouteCircuitAuthorizationsClient creates an instance of the ExpressRouteCircuitAuthorizationsClient
@ -40,50 +41,29 @@ func NewExpressRouteCircuitAuthorizationsClientWithBaseURI(baseURI string, subsc
return ExpressRouteCircuitAuthorizationsClient{NewWithBaseURI(baseURI, subscriptionID)} return ExpressRouteCircuitAuthorizationsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates an authorization in the specified express route circuit. This method may poll for // CreateOrUpdate creates or updates an authorization in the specified express route circuit.
// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
// authorizationName is the name of the authorization. authorizationParameters is parameters supplied to the create or // authorizationName is the name of the authorization. authorizationParameters is parameters supplied to the create or
// update express route circuit authorization operation. // update express route circuit authorization operation.
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, cancel <-chan struct{}) (<-chan ExpressRouteCircuitAuthorization, <-chan error) { func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization) (result ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) {
resultChan := make(chan ExpressRouteCircuitAuthorization, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, authorizationName, authorizationParameters)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request")
var err error return
var result ExpressRouteCircuitAuthorization }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, authorizationName, authorizationParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, cancel <-chan struct{}) (*http.Request, error) { func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"authorizationName": autorest.Encode("path", authorizationName), "authorizationName": autorest.Encode("path", authorizationName),
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
@ -103,16 +83,22 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(res
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters),
autorest.WithJSON(authorizationParameters), autorest.WithJSON(authorizationParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -121,56 +107,35 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdateResponder(re
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result), autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing()) autorest.ByClosing())
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return return
} }
// Delete deletes the specified authorization from the specified express route circuit. This method may poll for // Delete deletes the specified authorization from the specified express route circuit.
// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
// authorizationName is the name of the authorization. // authorizationName is the name of the authorization.
func (client ExpressRouteCircuitAuthorizationsClient) Delete(resourceGroupName string, circuitName string, authorizationName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client ExpressRouteCircuitAuthorizationsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorizationsDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName, authorizationName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, circuitName, authorizationName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(resourceGroupName string, circuitName string, authorizationName string, cancel <-chan struct{}) (*http.Request, error) { func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"authorizationName": autorest.Encode("path", authorizationName), "authorizationName": autorest.Encode("path", authorizationName),
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
@ -188,16 +153,22 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(resourceGro
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitAuthorizationsClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitAuthorizationsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitAuthorizationsDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -206,7 +177,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeleteResponder(resp *http
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -216,8 +187,8 @@ func (client ExpressRouteCircuitAuthorizationsClient) DeleteResponder(resp *http
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
// authorizationName is the name of the authorization. // authorizationName is the name of the authorization.
func (client ExpressRouteCircuitAuthorizationsClient) Get(resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorization, err error) { func (client ExpressRouteCircuitAuthorizationsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (result ExpressRouteCircuitAuthorization, err error) {
req, err := client.GetPreparer(resourceGroupName, circuitName, authorizationName) req, err := client.GetPreparer(ctx, resourceGroupName, circuitName, authorizationName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "Get", nil, "Failure preparing request")
return return
@ -239,7 +210,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) Get(resourceGroupName stri
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(resourceGroupName string, circuitName string, authorizationName string) (*http.Request, error) { func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string, authorizationName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"authorizationName": autorest.Encode("path", authorizationName), "authorizationName": autorest.Encode("path", authorizationName),
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
@ -257,14 +228,13 @@ func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(resourceGroupN
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitAuthorizationsClient) GetSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitAuthorizationsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -284,8 +254,9 @@ func (client ExpressRouteCircuitAuthorizationsClient) GetResponder(resp *http.Re
// List gets all authorizations in an express route circuit. // List gets all authorizations in an express route circuit.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the circuit.
func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName string, circuitName string) (result AuthorizationListResult, err error) { func (client ExpressRouteCircuitAuthorizationsClient) List(ctx context.Context, resourceGroupName string, circuitName string) (result AuthorizationListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, circuitName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, circuitName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing request")
return return
@ -293,12 +264,12 @@ func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName str
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.alr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.alr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to request")
} }
@ -307,7 +278,7 @@ func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName str
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(resourceGroupName string, circuitName string) (*http.Request, error) { func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -324,14 +295,13 @@ func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(resourceGroup
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitAuthorizationsClient) ListSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitAuthorizationsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -348,71 +318,29 @@ func (client ExpressRouteCircuitAuthorizationsClient) ListResponder(resp *http.R
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client ExpressRouteCircuitAuthorizationsClient) ListNextResults(lastResults AuthorizationListResult) (result AuthorizationListResult, err error) { func (client ExpressRouteCircuitAuthorizationsClient) listNextResults(lastResults AuthorizationListResult) (result AuthorizationListResult, err error) {
req, err := lastResults.AuthorizationListResultPreparer() req, err := lastResults.authorizationListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitAuthorizationsClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client ExpressRouteCircuitAuthorizationsClient) ListComplete(resourceGroupName string, circuitName string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitAuthorization, <-chan error) { func (client ExpressRouteCircuitAuthorizationsClient) ListComplete(ctx context.Context, resourceGroupName string, circuitName string) (result AuthorizationListResultIterator, err error) {
resultChan := make(chan ExpressRouteCircuitAuthorization) result.page, err = client.List(ctx, resourceGroupName, circuitName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, circuitName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// ExpressRouteCircuitPeeringsClient is the network Client // ExpressRouteCircuitPeeringsClient is the network Client
type ExpressRouteCircuitPeeringsClient struct { type ExpressRouteCircuitPeeringsClient struct {
ManagementClient BaseClient
} }
// NewExpressRouteCircuitPeeringsClient creates an instance of the ExpressRouteCircuitPeeringsClient client. // NewExpressRouteCircuitPeeringsClient creates an instance of the ExpressRouteCircuitPeeringsClient client.
@ -38,50 +39,29 @@ func NewExpressRouteCircuitPeeringsClientWithBaseURI(baseURI string, subscriptio
return ExpressRouteCircuitPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} return ExpressRouteCircuitPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a peering in the specified express route circuits. This method may poll for // CreateOrUpdate creates or updates a peering in the specified express route circuits.
// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
// peeringName is the name of the peering. peeringParameters is parameters supplied to the create or update express // peeringName is the name of the peering. peeringParameters is parameters supplied to the create or update express
// route circuit peering operation. // route circuit peering operation.
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, cancel <-chan struct{}) (<-chan ExpressRouteCircuitPeering, <-chan error) { func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering) (result ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) {
resultChan := make(chan ExpressRouteCircuitPeering, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, peeringName, peeringParameters)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request")
var err error return
var result ExpressRouteCircuitPeering }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, peeringName, peeringParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, cancel <-chan struct{}) (*http.Request, error) { func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"peeringName": autorest.Encode("path", peeringName), "peeringName": autorest.Encode("path", peeringName),
@ -101,16 +81,22 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(resourceG
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters),
autorest.WithJSON(peeringParameters), autorest.WithJSON(peeringParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitPeeringsCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -126,49 +112,28 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdateResponder(resp *ht
return return
} }
// Delete deletes the specified peering from the specified express route circuit. This method may poll for completion. // Delete deletes the specified peering from the specified express route circuit.
// Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
// peeringName is the name of the peering. // peeringName is the name of the peering.
func (client ExpressRouteCircuitPeeringsClient) Delete(resourceGroupName string, circuitName string, peeringName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client ExpressRouteCircuitPeeringsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeeringsDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName, peeringName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, circuitName, peeringName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(resourceGroupName string, circuitName string, peeringName string, cancel <-chan struct{}) (*http.Request, error) { func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"peeringName": autorest.Encode("path", peeringName), "peeringName": autorest.Encode("path", peeringName),
@ -186,16 +151,22 @@ func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(resourceGroupName
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitPeeringsClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitPeeringsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitPeeringsDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -214,8 +185,8 @@ func (client ExpressRouteCircuitPeeringsClient) DeleteResponder(resp *http.Respo
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
// peeringName is the name of the peering. // peeringName is the name of the peering.
func (client ExpressRouteCircuitPeeringsClient) Get(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeering, err error) { func (client ExpressRouteCircuitPeeringsClient) Get(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitPeering, err error) {
req, err := client.GetPreparer(resourceGroupName, circuitName, peeringName) req, err := client.GetPreparer(ctx, resourceGroupName, circuitName, peeringName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "Get", nil, "Failure preparing request")
return return
@ -237,7 +208,7 @@ func (client ExpressRouteCircuitPeeringsClient) Get(resourceGroupName string, ci
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client ExpressRouteCircuitPeeringsClient) GetPreparer(resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) { func (client ExpressRouteCircuitPeeringsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"peeringName": autorest.Encode("path", peeringName), "peeringName": autorest.Encode("path", peeringName),
@ -255,14 +226,13 @@ func (client ExpressRouteCircuitPeeringsClient) GetPreparer(resourceGroupName st
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitPeeringsClient) GetSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitPeeringsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -282,8 +252,9 @@ func (client ExpressRouteCircuitPeeringsClient) GetResponder(resp *http.Response
// List gets all peerings in a specified express route circuit. // List gets all peerings in a specified express route circuit.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResult, err error) { func (client ExpressRouteCircuitPeeringsClient) List(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, circuitName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, circuitName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing request")
return return
@ -291,12 +262,12 @@ func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, c
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.ercplr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.ercplr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to request")
} }
@ -305,7 +276,7 @@ func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, c
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client ExpressRouteCircuitPeeringsClient) ListPreparer(resourceGroupName string, circuitName string) (*http.Request, error) { func (client ExpressRouteCircuitPeeringsClient) ListPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -322,14 +293,13 @@ func (client ExpressRouteCircuitPeeringsClient) ListPreparer(resourceGroupName s
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitPeeringsClient) ListSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitPeeringsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -346,71 +316,29 @@ func (client ExpressRouteCircuitPeeringsClient) ListResponder(resp *http.Respons
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client ExpressRouteCircuitPeeringsClient) ListNextResults(lastResults ExpressRouteCircuitPeeringListResult) (result ExpressRouteCircuitPeeringListResult, err error) { func (client ExpressRouteCircuitPeeringsClient) listNextResults(lastResults ExpressRouteCircuitPeeringListResult) (result ExpressRouteCircuitPeeringListResult, err error) {
req, err := lastResults.ExpressRouteCircuitPeeringListResultPreparer() req, err := lastResults.expressRouteCircuitPeeringListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitPeeringsClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client ExpressRouteCircuitPeeringsClient) ListComplete(resourceGroupName string, circuitName string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitPeering, <-chan error) { func (client ExpressRouteCircuitPeeringsClient) ListComplete(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitPeeringListResultIterator, err error) {
resultChan := make(chan ExpressRouteCircuitPeering) result.page, err = client.List(ctx, resourceGroupName, circuitName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, circuitName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// ExpressRouteCircuitsClient is the network Client // ExpressRouteCircuitsClient is the network Client
type ExpressRouteCircuitsClient struct { type ExpressRouteCircuitsClient struct {
ManagementClient BaseClient
} }
// NewExpressRouteCircuitsClient creates an instance of the ExpressRouteCircuitsClient client. // NewExpressRouteCircuitsClient creates an instance of the ExpressRouteCircuitsClient client.
@ -38,49 +39,28 @@ func NewExpressRouteCircuitsClientWithBaseURI(baseURI string, subscriptionID str
return ExpressRouteCircuitsClient{NewWithBaseURI(baseURI, subscriptionID)} return ExpressRouteCircuitsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates an express route circuit. This method may poll for completion. Polling can be // CreateOrUpdate creates or updates an express route circuit.
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the circuit. parameters is // resourceGroupName is the name of the resource group. circuitName is the name of the circuit. parameters is
// parameters supplied to the create or update express route circuit operation. // parameters supplied to the create or update express route circuit operation.
func (client ExpressRouteCircuitsClient) CreateOrUpdate(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, cancel <-chan struct{}) (<-chan ExpressRouteCircuit, <-chan error) { func (client ExpressRouteCircuitsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit) (result ExpressRouteCircuitsCreateOrUpdateFuture, err error) {
resultChan := make(chan ExpressRouteCircuit, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, circuitName, parameters)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", nil, "Failure preparing request")
var err error return
var result ExpressRouteCircuit }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, circuitName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, cancel <-chan struct{}) (*http.Request, error) { func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, circuitName string, parameters ExpressRouteCircuit) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -99,16 +79,22 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(resourceGroupNam
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
autorest.WithJSON(parameters), autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCircuitsCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -117,54 +103,34 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdateResponder(resp *http.Resp
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result), autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing()) autorest.ByClosing())
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return return
} }
// Delete deletes the specified express route circuit. This method may poll for completion. Polling can be canceled by // Delete deletes the specified express route circuit.
// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
func (client ExpressRouteCircuitsClient) Delete(resourceGroupName string, circuitName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client ExpressRouteCircuitsClient) Delete(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitsDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, circuitName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, circuitName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client ExpressRouteCircuitsClient) DeletePreparer(resourceGroupName string, circuitName string, cancel <-chan struct{}) (*http.Request, error) { func (client ExpressRouteCircuitsClient) DeletePreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -181,16 +147,22 @@ func (client ExpressRouteCircuitsClient) DeletePreparer(resourceGroupName string
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitsClient) DeleteSender(req *http.Request) (future ExpressRouteCircuitsDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -199,7 +171,7 @@ func (client ExpressRouteCircuitsClient) DeleteResponder(resp *http.Response) (r
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -208,8 +180,8 @@ func (client ExpressRouteCircuitsClient) DeleteResponder(resp *http.Response) (r
// Get gets information about the specified express route circuit. // Get gets information about the specified express route circuit.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of express route circuit.
func (client ExpressRouteCircuitsClient) Get(resourceGroupName string, circuitName string) (result ExpressRouteCircuit, err error) { func (client ExpressRouteCircuitsClient) Get(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuit, err error) {
req, err := client.GetPreparer(resourceGroupName, circuitName) req, err := client.GetPreparer(ctx, resourceGroupName, circuitName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "Get", nil, "Failure preparing request")
return return
@ -231,7 +203,7 @@ func (client ExpressRouteCircuitsClient) Get(resourceGroupName string, circuitNa
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client ExpressRouteCircuitsClient) GetPreparer(resourceGroupName string, circuitName string) (*http.Request, error) { func (client ExpressRouteCircuitsClient) GetPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -248,14 +220,13 @@ func (client ExpressRouteCircuitsClient) GetPreparer(resourceGroupName string, c
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) GetSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -276,8 +247,8 @@ func (client ExpressRouteCircuitsClient) GetResponder(resp *http.Response) (resu
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
// peeringName is the name of the peering. // peeringName is the name of the peering.
func (client ExpressRouteCircuitsClient) GetPeeringStats(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitStats, err error) { func (client ExpressRouteCircuitsClient) GetPeeringStats(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitStats, err error) {
req, err := client.GetPeeringStatsPreparer(resourceGroupName, circuitName, peeringName) req, err := client.GetPeeringStatsPreparer(ctx, resourceGroupName, circuitName, peeringName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", nil, "Failure preparing request")
return return
@ -299,7 +270,7 @@ func (client ExpressRouteCircuitsClient) GetPeeringStats(resourceGroupName strin
} }
// GetPeeringStatsPreparer prepares the GetPeeringStats request. // GetPeeringStatsPreparer prepares the GetPeeringStats request.
func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) { func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"peeringName": autorest.Encode("path", peeringName), "peeringName": autorest.Encode("path", peeringName),
@ -317,14 +288,13 @@ func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(resourceGroupNa
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetPeeringStatsSender sends the GetPeeringStats request. The method will close the // GetPeeringStatsSender sends the GetPeeringStats request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) GetPeeringStatsSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitsClient) GetPeeringStatsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -344,8 +314,8 @@ func (client ExpressRouteCircuitsClient) GetPeeringStatsResponder(resp *http.Res
// GetStats gets all the stats from an express route circuit in a resource group. // GetStats gets all the stats from an express route circuit in a resource group.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
func (client ExpressRouteCircuitsClient) GetStats(resourceGroupName string, circuitName string) (result ExpressRouteCircuitStats, err error) { func (client ExpressRouteCircuitsClient) GetStats(ctx context.Context, resourceGroupName string, circuitName string) (result ExpressRouteCircuitStats, err error) {
req, err := client.GetStatsPreparer(resourceGroupName, circuitName) req, err := client.GetStatsPreparer(ctx, resourceGroupName, circuitName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", nil, "Failure preparing request")
return return
@ -367,7 +337,7 @@ func (client ExpressRouteCircuitsClient) GetStats(resourceGroupName string, circ
} }
// GetStatsPreparer prepares the GetStats request. // GetStatsPreparer prepares the GetStats request.
func (client ExpressRouteCircuitsClient) GetStatsPreparer(resourceGroupName string, circuitName string) (*http.Request, error) { func (client ExpressRouteCircuitsClient) GetStatsPreparer(ctx context.Context, resourceGroupName string, circuitName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -384,14 +354,13 @@ func (client ExpressRouteCircuitsClient) GetStatsPreparer(resourceGroupName stri
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetStatsSender sends the GetStats request. The method will close the // GetStatsSender sends the GetStats request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) GetStatsSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitsClient) GetStatsSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -411,8 +380,9 @@ func (client ExpressRouteCircuitsClient) GetStatsResponder(resp *http.Response)
// List gets all the express route circuits in a resource group. // List gets all the express route circuits in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result ExpressRouteCircuitListResult, err error) { func (client ExpressRouteCircuitsClient) List(ctx context.Context, resourceGroupName string) (result ExpressRouteCircuitListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing request")
return return
@ -420,12 +390,12 @@ func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.erclr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.erclr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to request")
} }
@ -434,7 +404,7 @@ func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client ExpressRouteCircuitsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { func (client ExpressRouteCircuitsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -450,14 +420,13 @@ func (client ExpressRouteCircuitsClient) ListPreparer(resourceGroupName string)
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) ListSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -474,78 +443,37 @@ func (client ExpressRouteCircuitsClient) ListResponder(resp *http.Response) (res
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client ExpressRouteCircuitsClient) ListNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) { func (client ExpressRouteCircuitsClient) listNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) {
req, err := lastResults.ExpressRouteCircuitListResultPreparer() req, err := lastResults.expressRouteCircuitListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client ExpressRouteCircuitsClient) ListComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan ExpressRouteCircuit, <-chan error) { func (client ExpressRouteCircuitsClient) ListComplete(ctx context.Context, resourceGroupName string) (result ExpressRouteCircuitListResultIterator, err error) {
resultChan := make(chan ExpressRouteCircuit) result.page, err = client.List(ctx, resourceGroupName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
// ListAll gets all the express route circuits in a subscription. // ListAll gets all the express route circuits in a subscription.
func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitListResult, err error) { func (client ExpressRouteCircuitsClient) ListAll(ctx context.Context) (result ExpressRouteCircuitListResultPage, err error) {
req, err := client.ListAllPreparer() result.fn = client.listAllNextResults
req, err := client.ListAllPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing request")
return return
@ -553,12 +481,12 @@ func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitLi
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.erclr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending request")
return return
} }
result, err = client.ListAllResponder(resp) result.erclr, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to request")
} }
@ -567,7 +495,7 @@ func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitLi
} }
// ListAllPreparer prepares the ListAll request. // ListAllPreparer prepares the ListAll request.
func (client ExpressRouteCircuitsClient) ListAllPreparer() (*http.Request, error) { func (client ExpressRouteCircuitsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
} }
@ -582,14 +510,13 @@ func (client ExpressRouteCircuitsClient) ListAllPreparer() (*http.Request, error
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListAllSender sends the ListAll request. The method will close the // ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) ListAllSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitsClient) ListAllSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -606,118 +533,55 @@ func (client ExpressRouteCircuitsClient) ListAllResponder(resp *http.Response) (
return return
} }
// ListAllNextResults retrieves the next set of results, if any. // listAllNextResults retrieves the next set of results, if any.
func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) { func (client ExpressRouteCircuitsClient) listAllNextResults(lastResults ExpressRouteCircuitListResult) (result ExpressRouteCircuitListResult, err error) {
req, err := lastResults.ExpressRouteCircuitListResultPreparer() req, err := lastResults.expressRouteCircuitListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listAllNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listAllNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListAll", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "listAllNextResults", resp, "Failure responding to next results request")
}
return
}
// ListAllComplete enumerates all values, automatically crossing page boundaries as required.
func (client ExpressRouteCircuitsClient) ListAllComplete(ctx context.Context) (result ExpressRouteCircuitListResultIterator, err error) {
result.page, err = client.ListAll(ctx)
return
}
// ListArpTable gets the currently advertised ARP table associated with the express route circuit in a resource group.
//
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
// peeringName is the name of the peering. devicePath is the path of the device.
func (client ExpressRouteCircuitsClient) ListArpTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListArpTableFuture, err error) {
req, err := client.ListArpTablePreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing request")
return
}
result, err = client.ListArpTableSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", result.Response(), "Failure sending request")
return
} }
return return
} }
// ListAllComplete gets all elements from the list without paging.
func (client ExpressRouteCircuitsClient) ListAllComplete(cancel <-chan struct{}) (<-chan ExpressRouteCircuit, <-chan error) {
resultChan := make(chan ExpressRouteCircuit)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListAll()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListAllNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// ListArpTable gets the currently advertised ARP table associated with the express route circuit in a resource group.
// This method may poll for completion. Polling can be canceled by passing the cancel channel argument. The channel
// will be used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
// peeringName is the name of the peering. devicePath is the path of the device.
func (client ExpressRouteCircuitsClient) ListArpTable(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitsArpTableListResult, <-chan error) {
resultChan := make(chan ExpressRouteCircuitsArpTableListResult, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result ExpressRouteCircuitsArpTableListResult
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.ListArpTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing request")
return
}
resp, err := client.ListArpTableSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure sending request")
return
}
result, err = client.ListArpTableResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// ListArpTablePreparer prepares the ListArpTable request. // ListArpTablePreparer prepares the ListArpTable request.
func (client ExpressRouteCircuitsClient) ListArpTablePreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) { func (client ExpressRouteCircuitsClient) ListArpTablePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"devicePath": autorest.Encode("path", devicePath), "devicePath": autorest.Encode("path", devicePath),
@ -736,16 +600,22 @@ func (client ExpressRouteCircuitsClient) ListArpTablePreparer(resourceGroupName
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListArpTableSender sends the ListArpTable request. The method will close the // ListArpTableSender sends the ListArpTable request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) ListArpTableSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitsClient) ListArpTableSender(req *http.Request) (future ExpressRouteCircuitsListArpTableFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
return
} }
// ListArpTableResponder handles the response to the ListArpTable request. The method always // ListArpTableResponder handles the response to the ListArpTable request. The method always
@ -762,48 +632,28 @@ func (client ExpressRouteCircuitsClient) ListArpTableResponder(resp *http.Respon
} }
// ListRoutesTable gets the currently advertised routes table associated with the express route circuit in a resource // ListRoutesTable gets the currently advertised routes table associated with the express route circuit in a resource
// group. This method may poll for completion. Polling can be canceled by passing the cancel channel argument. The // group.
// channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
// peeringName is the name of the peering. devicePath is the path of the device. // peeringName is the name of the peering. devicePath is the path of the device.
func (client ExpressRouteCircuitsClient) ListRoutesTable(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitsRoutesTableListResult, <-chan error) { func (client ExpressRouteCircuitsClient) ListRoutesTable(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListRoutesTableFuture, err error) {
resultChan := make(chan ExpressRouteCircuitsRoutesTableListResult, 1) req, err := client.ListRoutesTablePreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing request")
var err error return
var result ExpressRouteCircuitsRoutesTableListResult }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.ListRoutesTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing request")
return
}
resp, err := client.ListRoutesTableSender(req) result, err = client.ListRoutesTableSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure sending request") return
return }
}
result, err = client.ListRoutesTableResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// ListRoutesTablePreparer prepares the ListRoutesTable request. // ListRoutesTablePreparer prepares the ListRoutesTable request.
func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) { func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"devicePath": autorest.Encode("path", devicePath), "devicePath": autorest.Encode("path", devicePath),
@ -822,16 +672,22 @@ func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(resourceGroupNa
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListRoutesTableSender sends the ListRoutesTable request. The method will close the // ListRoutesTableSender sends the ListRoutesTable request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) ListRoutesTableSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitsClient) ListRoutesTableSender(req *http.Request) (future ExpressRouteCircuitsListRoutesTableFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
return
} }
// ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always // ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always
@ -848,48 +704,28 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableResponder(resp *http.Res
} }
// ListRoutesTableSummary gets the currently advertised routes table summary associated with the express route circuit // ListRoutesTableSummary gets the currently advertised routes table summary associated with the express route circuit
// in a resource group. This method may poll for completion. Polling can be canceled by passing the cancel channel // in a resource group.
// argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit. // resourceGroupName is the name of the resource group. circuitName is the name of the express route circuit.
// peeringName is the name of the peering. devicePath is the path of the device. // peeringName is the name of the peering. devicePath is the path of the device.
func (client ExpressRouteCircuitsClient) ListRoutesTableSummary(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (<-chan ExpressRouteCircuitsRoutesTableSummaryListResult, <-chan error) { func (client ExpressRouteCircuitsClient) ListRoutesTableSummary(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (result ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) {
resultChan := make(chan ExpressRouteCircuitsRoutesTableSummaryListResult, 1) req, err := client.ListRoutesTableSummaryPreparer(ctx, resourceGroupName, circuitName, peeringName, devicePath)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", nil, "Failure preparing request")
var err error return
var result ExpressRouteCircuitsRoutesTableSummaryListResult }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.ListRoutesTableSummaryPreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", nil, "Failure preparing request")
return
}
resp, err := client.ListRoutesTableSummarySender(req) result, err = client.ListRoutesTableSummarySender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", resp, "Failure sending request") return
return }
}
result, err = client.ListRoutesTableSummaryResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request. // ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request.
func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) { func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(ctx context.Context, resourceGroupName string, circuitName string, peeringName string, devicePath string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName), "circuitName": autorest.Encode("path", circuitName),
"devicePath": autorest.Encode("path", devicePath), "devicePath": autorest.Encode("path", devicePath),
@ -908,16 +744,22 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(resource
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the // ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) ListRoutesTableSummarySender(req *http.Request) (*http.Response, error) { func (client ExpressRouteCircuitsClient) ListRoutesTableSummarySender(req *http.Request) (future ExpressRouteCircuitsListRoutesTableSummaryFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
return
} }
// ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always // ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always
@ -932,3 +774,74 @@ func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryResponder(resp *h
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return return
} }
// UpdateTags updates an express route circuit tags.
//
// resourceGroupName is the name of the resource group. circuitName is the name of the circuit. parameters is
// parameters supplied to update express route circuit tags.
func (client ExpressRouteCircuitsClient) UpdateTags(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject) (result ExpressRouteCircuitsUpdateTagsFuture, err error) {
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, circuitName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "UpdateTags", nil, "Failure preparing request")
return
}
result, err = client.UpdateTagsSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "UpdateTags", result.Response(), "Failure sending request")
return
}
return
}
// UpdateTagsPreparer prepares the UpdateTags request.
func (client ExpressRouteCircuitsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, circuitName string, parameters TagsObject) (*http.Request, error) {
pathParameters := map[string]interface{}{
"circuitName": autorest.Encode("path", circuitName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// UpdateTagsSender sends the UpdateTags request. The method will close the
// http.Response Body if it receives an error.
func (client ExpressRouteCircuitsClient) UpdateTagsSender(req *http.Request) (future ExpressRouteCircuitsUpdateTagsFuture, err error) {
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
future.Future = azure.NewFuture(req)
future.req = req
_, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK))
return
}
// UpdateTagsResponder handles the response to the UpdateTags request. The method always
// closes the http.Response Body.
func (client ExpressRouteCircuitsClient) UpdateTagsResponder(resp *http.Response) (result ExpressRouteCircuit, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// ExpressRouteServiceProvidersClient is the network Client // ExpressRouteServiceProvidersClient is the network Client
type ExpressRouteServiceProvidersClient struct { type ExpressRouteServiceProvidersClient struct {
ManagementClient BaseClient
} }
// NewExpressRouteServiceProvidersClient creates an instance of the ExpressRouteServiceProvidersClient client. // NewExpressRouteServiceProvidersClient creates an instance of the ExpressRouteServiceProvidersClient client.
@ -40,8 +41,9 @@ func NewExpressRouteServiceProvidersClientWithBaseURI(baseURI string, subscripti
} }
// List gets all the available express route service providers. // List gets all the available express route service providers.
func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServiceProviderListResult, err error) { func (client ExpressRouteServiceProvidersClient) List(ctx context.Context) (result ExpressRouteServiceProviderListResultPage, err error) {
req, err := client.ListPreparer() result.fn = client.listNextResults
req, err := client.ListPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing request")
return return
@ -49,12 +51,12 @@ func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServ
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.ersplr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.ersplr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to request")
} }
@ -63,7 +65,7 @@ func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServ
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client ExpressRouteServiceProvidersClient) ListPreparer() (*http.Request, error) { func (client ExpressRouteServiceProvidersClient) ListPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
} }
@ -78,14 +80,13 @@ func (client ExpressRouteServiceProvidersClient) ListPreparer() (*http.Request,
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client ExpressRouteServiceProvidersClient) ListSender(req *http.Request) (*http.Response, error) { func (client ExpressRouteServiceProvidersClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -102,71 +103,29 @@ func (client ExpressRouteServiceProvidersClient) ListResponder(resp *http.Respon
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client ExpressRouteServiceProvidersClient) ListNextResults(lastResults ExpressRouteServiceProviderListResult) (result ExpressRouteServiceProviderListResult, err error) { func (client ExpressRouteServiceProvidersClient) listNextResults(lastResults ExpressRouteServiceProviderListResult) (result ExpressRouteServiceProviderListResult, err error) {
req, err := lastResults.ExpressRouteServiceProviderListResultPreparer() req, err := lastResults.expressRouteServiceProviderListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.ExpressRouteServiceProvidersClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client ExpressRouteServiceProvidersClient) ListComplete(cancel <-chan struct{}) (<-chan ExpressRouteServiceProvider, <-chan error) { func (client ExpressRouteServiceProvidersClient) ListComplete(ctx context.Context) (result ExpressRouteServiceProviderListResultIterator, err error) {
resultChan := make(chan ExpressRouteServiceProvider) result.page, err = client.List(ctx)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/autorest/validation"
@ -26,7 +27,7 @@ import (
// InboundNatRulesClient is the network Client // InboundNatRulesClient is the network Client
type InboundNatRulesClient struct { type InboundNatRulesClient struct {
ManagementClient BaseClient
} }
// NewInboundNatRulesClient creates an instance of the InboundNatRulesClient client. // NewInboundNatRulesClient creates an instance of the InboundNatRulesClient client.
@ -39,16 +40,12 @@ func NewInboundNatRulesClientWithBaseURI(baseURI string, subscriptionID string)
return InboundNatRulesClient{NewWithBaseURI(baseURI, subscriptionID)} return InboundNatRulesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a load balancer inbound nat rule. This method may poll for completion. Polling can // CreateOrUpdate creates or updates a load balancer inbound nat rule.
// be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
// inboundNatRuleName is the name of the inbound nat rule. inboundNatRuleParameters is parameters supplied to the // inboundNatRuleName is the name of the inbound nat rule. inboundNatRuleParameters is parameters supplied to the
// create or update inbound nat rule operation. // create or update inbound nat rule operation.
func (client InboundNatRulesClient) CreateOrUpdate(resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule, cancel <-chan struct{}) (<-chan InboundNatRule, <-chan error) { func (client InboundNatRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule) (result InboundNatRulesCreateOrUpdateFuture, err error) {
resultChan := make(chan InboundNatRule, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: inboundNatRuleParameters, {TargetValue: inboundNatRuleParameters,
Constraints: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat", Name: validation.Null, Rule: false, Constraints: []validation.Constraint{{Target: "inboundNatRuleParameters.InboundNatRulePropertiesFormat", Name: validation.Null, Rule: false,
@ -65,46 +62,26 @@ func (client InboundNatRulesClient) CreateOrUpdate(resourceGroupName string, loa
}}, }},
}}, }},
}}}}}); err != nil { }}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "network.InboundNatRulesClient", "CreateOrUpdate") return result, validation.NewErrorWithValidationError(err, "network.InboundNatRulesClient", "CreateOrUpdate")
close(errChan)
close(resultChan)
return resultChan, errChan
} }
go func() { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters)
var err error if err != nil {
var result InboundNatRule err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "CreateOrUpdate", nil, "Failure preparing request")
defer func() { return
if err != nil { }
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client InboundNatRulesClient) CreateOrUpdatePreparer(resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule, cancel <-chan struct{}) (*http.Request, error) { func (client InboundNatRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"inboundNatRuleName": autorest.Encode("path", inboundNatRuleName), "inboundNatRuleName": autorest.Encode("path", inboundNatRuleName),
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
@ -124,16 +101,22 @@ func (client InboundNatRulesClient) CreateOrUpdatePreparer(resourceGroupName str
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", pathParameters),
autorest.WithJSON(inboundNatRuleParameters), autorest.WithJSON(inboundNatRuleParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client InboundNatRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client InboundNatRulesClient) CreateOrUpdateSender(req *http.Request) (future InboundNatRulesCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -142,56 +125,35 @@ func (client InboundNatRulesClient) CreateOrUpdateResponder(resp *http.Response)
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result), autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing()) autorest.ByClosing())
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return return
} }
// Delete deletes the specified load balancer inbound nat rule. This method may poll for completion. Polling can be // Delete deletes the specified load balancer inbound nat rule.
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
// inboundNatRuleName is the name of the inbound nat rule. // inboundNatRuleName is the name of the inbound nat rule.
func (client InboundNatRulesClient) Delete(resourceGroupName string, loadBalancerName string, inboundNatRuleName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client InboundNatRulesClient) Delete(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string) (result InboundNatRulesDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, loadBalancerName, inboundNatRuleName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client InboundNatRulesClient) DeletePreparer(resourceGroupName string, loadBalancerName string, inboundNatRuleName string, cancel <-chan struct{}) (*http.Request, error) { func (client InboundNatRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"inboundNatRuleName": autorest.Encode("path", inboundNatRuleName), "inboundNatRuleName": autorest.Encode("path", inboundNatRuleName),
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
@ -209,16 +171,22 @@ func (client InboundNatRulesClient) DeletePreparer(resourceGroupName string, loa
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client InboundNatRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client InboundNatRulesClient) DeleteSender(req *http.Request) (future InboundNatRulesDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -227,7 +195,7 @@ func (client InboundNatRulesClient) DeleteResponder(resp *http.Response) (result
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -237,8 +205,8 @@ func (client InboundNatRulesClient) DeleteResponder(resp *http.Response) (result
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
// inboundNatRuleName is the name of the inbound nat rule. expand is expands referenced resources. // inboundNatRuleName is the name of the inbound nat rule. expand is expands referenced resources.
func (client InboundNatRulesClient) Get(resourceGroupName string, loadBalancerName string, inboundNatRuleName string, expand string) (result InboundNatRule, err error) { func (client InboundNatRulesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, expand string) (result InboundNatRule, err error) {
req, err := client.GetPreparer(resourceGroupName, loadBalancerName, inboundNatRuleName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, expand)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "Get", nil, "Failure preparing request")
return return
@ -260,7 +228,7 @@ func (client InboundNatRulesClient) Get(resourceGroupName string, loadBalancerNa
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client InboundNatRulesClient) GetPreparer(resourceGroupName string, loadBalancerName string, inboundNatRuleName string, expand string) (*http.Request, error) { func (client InboundNatRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"inboundNatRuleName": autorest.Encode("path", inboundNatRuleName), "inboundNatRuleName": autorest.Encode("path", inboundNatRuleName),
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
@ -281,14 +249,13 @@ func (client InboundNatRulesClient) GetPreparer(resourceGroupName string, loadBa
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules/{inboundNatRuleName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client InboundNatRulesClient) GetSender(req *http.Request) (*http.Response, error) { func (client InboundNatRulesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -308,8 +275,9 @@ func (client InboundNatRulesClient) GetResponder(resp *http.Response) (result In
// List gets all the inbound nat rules in a load balancer. // List gets all the inbound nat rules in a load balancer.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
func (client InboundNatRulesClient) List(resourceGroupName string, loadBalancerName string) (result InboundNatRuleListResult, err error) { func (client InboundNatRulesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result InboundNatRuleListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, loadBalancerName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", nil, "Failure preparing request")
return return
@ -317,12 +285,12 @@ func (client InboundNatRulesClient) List(resourceGroupName string, loadBalancerN
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.inrlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.inrlr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", resp, "Failure responding to request")
} }
@ -331,7 +299,7 @@ func (client InboundNatRulesClient) List(resourceGroupName string, loadBalancerN
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client InboundNatRulesClient) ListPreparer(resourceGroupName string, loadBalancerName string) (*http.Request, error) { func (client InboundNatRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -348,14 +316,13 @@ func (client InboundNatRulesClient) ListPreparer(resourceGroupName string, loadB
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatRules", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client InboundNatRulesClient) ListSender(req *http.Request) (*http.Response, error) { func (client InboundNatRulesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -372,71 +339,29 @@ func (client InboundNatRulesClient) ListResponder(resp *http.Response) (result I
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client InboundNatRulesClient) ListNextResults(lastResults InboundNatRuleListResult) (result InboundNatRuleListResult, err error) { func (client InboundNatRulesClient) listNextResults(lastResults InboundNatRuleListResult) (result InboundNatRuleListResult, err error) {
req, err := lastResults.InboundNatRuleListResultPreparer() req, err := lastResults.inboundNatRuleListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.InboundNatRulesClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client InboundNatRulesClient) ListComplete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (<-chan InboundNatRule, <-chan error) { func (client InboundNatRulesClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result InboundNatRuleListResultIterator, err error) {
resultChan := make(chan InboundNatRule) result.page, err = client.List(ctx, resourceGroupName, loadBalancerName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, loadBalancerName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// InterfaceIPConfigurationsClient is the network Client // InterfaceIPConfigurationsClient is the network Client
type InterfaceIPConfigurationsClient struct { type InterfaceIPConfigurationsClient struct {
ManagementClient BaseClient
} }
// NewInterfaceIPConfigurationsClient creates an instance of the InterfaceIPConfigurationsClient client. // NewInterfaceIPConfigurationsClient creates an instance of the InterfaceIPConfigurationsClient client.
@ -42,8 +43,8 @@ func NewInterfaceIPConfigurationsClientWithBaseURI(baseURI string, subscriptionI
// //
// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface. // resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface.
// IPConfigurationName is the name of the ip configuration name. // IPConfigurationName is the name of the ip configuration name.
func (client InterfaceIPConfigurationsClient) Get(resourceGroupName string, networkInterfaceName string, IPConfigurationName string) (result InterfaceIPConfiguration, err error) { func (client InterfaceIPConfigurationsClient) Get(ctx context.Context, resourceGroupName string, networkInterfaceName string, IPConfigurationName string) (result InterfaceIPConfiguration, err error) {
req, err := client.GetPreparer(resourceGroupName, networkInterfaceName, IPConfigurationName) req, err := client.GetPreparer(ctx, resourceGroupName, networkInterfaceName, IPConfigurationName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "Get", nil, "Failure preparing request")
return return
@ -65,7 +66,7 @@ func (client InterfaceIPConfigurationsClient) Get(resourceGroupName string, netw
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client InterfaceIPConfigurationsClient) GetPreparer(resourceGroupName string, networkInterfaceName string, IPConfigurationName string) (*http.Request, error) { func (client InterfaceIPConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string, IPConfigurationName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"ipConfigurationName": autorest.Encode("path", IPConfigurationName), "ipConfigurationName": autorest.Encode("path", IPConfigurationName),
"networkInterfaceName": autorest.Encode("path", networkInterfaceName), "networkInterfaceName": autorest.Encode("path", networkInterfaceName),
@ -83,14 +84,13 @@ func (client InterfaceIPConfigurationsClient) GetPreparer(resourceGroupName stri
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations/{ipConfigurationName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client InterfaceIPConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { func (client InterfaceIPConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -110,8 +110,9 @@ func (client InterfaceIPConfigurationsClient) GetResponder(resp *http.Response)
// List get all ip configurations in a network interface // List get all ip configurations in a network interface
// //
// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface. // resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface.
func (client InterfaceIPConfigurationsClient) List(resourceGroupName string, networkInterfaceName string) (result InterfaceIPConfigurationListResult, err error) { func (client InterfaceIPConfigurationsClient) List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceIPConfigurationListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, networkInterfaceName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, networkInterfaceName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", nil, "Failure preparing request")
return return
@ -119,12 +120,12 @@ func (client InterfaceIPConfigurationsClient) List(resourceGroupName string, net
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.iiclr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.iiclr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", resp, "Failure responding to request")
} }
@ -133,7 +134,7 @@ func (client InterfaceIPConfigurationsClient) List(resourceGroupName string, net
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client InterfaceIPConfigurationsClient) ListPreparer(resourceGroupName string, networkInterfaceName string) (*http.Request, error) { func (client InterfaceIPConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkInterfaceName": autorest.Encode("path", networkInterfaceName), "networkInterfaceName": autorest.Encode("path", networkInterfaceName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -150,14 +151,13 @@ func (client InterfaceIPConfigurationsClient) ListPreparer(resourceGroupName str
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/ipConfigurations", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client InterfaceIPConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { func (client InterfaceIPConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -174,71 +174,29 @@ func (client InterfaceIPConfigurationsClient) ListResponder(resp *http.Response)
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client InterfaceIPConfigurationsClient) ListNextResults(lastResults InterfaceIPConfigurationListResult) (result InterfaceIPConfigurationListResult, err error) { func (client InterfaceIPConfigurationsClient) listNextResults(lastResults InterfaceIPConfigurationListResult) (result InterfaceIPConfigurationListResult, err error) {
req, err := lastResults.InterfaceIPConfigurationListResultPreparer() req, err := lastResults.interfaceIPConfigurationListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.InterfaceIPConfigurationsClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client InterfaceIPConfigurationsClient) ListComplete(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan InterfaceIPConfiguration, <-chan error) { func (client InterfaceIPConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceIPConfigurationListResultIterator, err error) {
resultChan := make(chan InterfaceIPConfiguration) result.page, err = client.List(ctx, resourceGroupName, networkInterfaceName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, networkInterfaceName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// InterfaceLoadBalancersClient is the network Client // InterfaceLoadBalancersClient is the network Client
type InterfaceLoadBalancersClient struct { type InterfaceLoadBalancersClient struct {
ManagementClient BaseClient
} }
// NewInterfaceLoadBalancersClient creates an instance of the InterfaceLoadBalancersClient client. // NewInterfaceLoadBalancersClient creates an instance of the InterfaceLoadBalancersClient client.
@ -41,8 +42,9 @@ func NewInterfaceLoadBalancersClientWithBaseURI(baseURI string, subscriptionID s
// List list all load balancers in a network interface. // List list all load balancers in a network interface.
// //
// resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface. // resourceGroupName is the name of the resource group. networkInterfaceName is the name of the network interface.
func (client InterfaceLoadBalancersClient) List(resourceGroupName string, networkInterfaceName string) (result InterfaceLoadBalancerListResult, err error) { func (client InterfaceLoadBalancersClient) List(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceLoadBalancerListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, networkInterfaceName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, networkInterfaceName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", nil, "Failure preparing request")
return return
@ -50,12 +52,12 @@ func (client InterfaceLoadBalancersClient) List(resourceGroupName string, networ
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.ilblr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.ilblr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", resp, "Failure responding to request")
} }
@ -64,7 +66,7 @@ func (client InterfaceLoadBalancersClient) List(resourceGroupName string, networ
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client InterfaceLoadBalancersClient) ListPreparer(resourceGroupName string, networkInterfaceName string) (*http.Request, error) { func (client InterfaceLoadBalancersClient) ListPreparer(ctx context.Context, resourceGroupName string, networkInterfaceName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkInterfaceName": autorest.Encode("path", networkInterfaceName), "networkInterfaceName": autorest.Encode("path", networkInterfaceName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -81,14 +83,13 @@ func (client InterfaceLoadBalancersClient) ListPreparer(resourceGroupName string
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/loadBalancers", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}/loadBalancers", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client InterfaceLoadBalancersClient) ListSender(req *http.Request) (*http.Response, error) { func (client InterfaceLoadBalancersClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -105,71 +106,29 @@ func (client InterfaceLoadBalancersClient) ListResponder(resp *http.Response) (r
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client InterfaceLoadBalancersClient) ListNextResults(lastResults InterfaceLoadBalancerListResult) (result InterfaceLoadBalancerListResult, err error) { func (client InterfaceLoadBalancersClient) listNextResults(lastResults InterfaceLoadBalancerListResult) (result InterfaceLoadBalancerListResult, err error) {
req, err := lastResults.InterfaceLoadBalancerListResultPreparer() req, err := lastResults.interfaceLoadBalancerListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.InterfaceLoadBalancersClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client InterfaceLoadBalancersClient) ListComplete(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (<-chan LoadBalancer, <-chan error) { func (client InterfaceLoadBalancersClient) ListComplete(ctx context.Context, resourceGroupName string, networkInterfaceName string) (result InterfaceLoadBalancerListResultIterator, err error) {
resultChan := make(chan LoadBalancer) result.page, err = client.List(ctx, resourceGroupName, networkInterfaceName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, networkInterfaceName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// LoadBalancerBackendAddressPoolsClient is the network Client // LoadBalancerBackendAddressPoolsClient is the network Client
type LoadBalancerBackendAddressPoolsClient struct { type LoadBalancerBackendAddressPoolsClient struct {
ManagementClient BaseClient
} }
// NewLoadBalancerBackendAddressPoolsClient creates an instance of the LoadBalancerBackendAddressPoolsClient client. // NewLoadBalancerBackendAddressPoolsClient creates an instance of the LoadBalancerBackendAddressPoolsClient client.
@ -43,8 +44,8 @@ func NewLoadBalancerBackendAddressPoolsClientWithBaseURI(baseURI string, subscri
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
// backendAddressPoolName is the name of the backend address pool. // backendAddressPoolName is the name of the backend address pool.
func (client LoadBalancerBackendAddressPoolsClient) Get(resourceGroupName string, loadBalancerName string, backendAddressPoolName string) (result BackendAddressPool, err error) { func (client LoadBalancerBackendAddressPoolsClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string) (result BackendAddressPool, err error) {
req, err := client.GetPreparer(resourceGroupName, loadBalancerName, backendAddressPoolName) req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, backendAddressPoolName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "Get", nil, "Failure preparing request")
return return
@ -66,7 +67,7 @@ func (client LoadBalancerBackendAddressPoolsClient) Get(resourceGroupName string
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client LoadBalancerBackendAddressPoolsClient) GetPreparer(resourceGroupName string, loadBalancerName string, backendAddressPoolName string) (*http.Request, error) { func (client LoadBalancerBackendAddressPoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, backendAddressPoolName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"backendAddressPoolName": autorest.Encode("path", backendAddressPoolName), "backendAddressPoolName": autorest.Encode("path", backendAddressPoolName),
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
@ -84,14 +85,13 @@ func (client LoadBalancerBackendAddressPoolsClient) GetPreparer(resourceGroupNam
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancerBackendAddressPoolsClient) GetSender(req *http.Request) (*http.Response, error) { func (client LoadBalancerBackendAddressPoolsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -111,8 +111,9 @@ func (client LoadBalancerBackendAddressPoolsClient) GetResponder(resp *http.Resp
// List gets all the load balancer backed address pools. // List gets all the load balancer backed address pools.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
func (client LoadBalancerBackendAddressPoolsClient) List(resourceGroupName string, loadBalancerName string) (result LoadBalancerBackendAddressPoolListResult, err error) { func (client LoadBalancerBackendAddressPoolsClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerBackendAddressPoolListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, loadBalancerName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "List", nil, "Failure preparing request")
return return
@ -120,12 +121,12 @@ func (client LoadBalancerBackendAddressPoolsClient) List(resourceGroupName strin
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.lbbaplr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.lbbaplr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "List", resp, "Failure responding to request")
} }
@ -134,7 +135,7 @@ func (client LoadBalancerBackendAddressPoolsClient) List(resourceGroupName strin
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client LoadBalancerBackendAddressPoolsClient) ListPreparer(resourceGroupName string, loadBalancerName string) (*http.Request, error) { func (client LoadBalancerBackendAddressPoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -151,14 +152,13 @@ func (client LoadBalancerBackendAddressPoolsClient) ListPreparer(resourceGroupNa
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancerBackendAddressPoolsClient) ListSender(req *http.Request) (*http.Response, error) { func (client LoadBalancerBackendAddressPoolsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -175,71 +175,29 @@ func (client LoadBalancerBackendAddressPoolsClient) ListResponder(resp *http.Res
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client LoadBalancerBackendAddressPoolsClient) ListNextResults(lastResults LoadBalancerBackendAddressPoolListResult) (result LoadBalancerBackendAddressPoolListResult, err error) { func (client LoadBalancerBackendAddressPoolsClient) listNextResults(lastResults LoadBalancerBackendAddressPoolListResult) (result LoadBalancerBackendAddressPoolListResult, err error) {
req, err := lastResults.LoadBalancerBackendAddressPoolListResultPreparer() req, err := lastResults.loadBalancerBackendAddressPoolListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.LoadBalancerBackendAddressPoolsClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client LoadBalancerBackendAddressPoolsClient) ListComplete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (<-chan BackendAddressPool, <-chan error) { func (client LoadBalancerBackendAddressPoolsClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerBackendAddressPoolListResultIterator, err error) {
resultChan := make(chan BackendAddressPool) result.page, err = client.List(ctx, resourceGroupName, loadBalancerName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, loadBalancerName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// LoadBalancerFrontendIPConfigurationsClient is the network Client // LoadBalancerFrontendIPConfigurationsClient is the network Client
type LoadBalancerFrontendIPConfigurationsClient struct { type LoadBalancerFrontendIPConfigurationsClient struct {
ManagementClient BaseClient
} }
// NewLoadBalancerFrontendIPConfigurationsClient creates an instance of the LoadBalancerFrontendIPConfigurationsClient // NewLoadBalancerFrontendIPConfigurationsClient creates an instance of the LoadBalancerFrontendIPConfigurationsClient
@ -44,8 +45,8 @@ func NewLoadBalancerFrontendIPConfigurationsClientWithBaseURI(baseURI string, su
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
// frontendIPConfigurationName is the name of the frontend IP configuration. // frontendIPConfigurationName is the name of the frontend IP configuration.
func (client LoadBalancerFrontendIPConfigurationsClient) Get(resourceGroupName string, loadBalancerName string, frontendIPConfigurationName string) (result FrontendIPConfiguration, err error) { func (client LoadBalancerFrontendIPConfigurationsClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, frontendIPConfigurationName string) (result FrontendIPConfiguration, err error) {
req, err := client.GetPreparer(resourceGroupName, loadBalancerName, frontendIPConfigurationName) req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, frontendIPConfigurationName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "Get", nil, "Failure preparing request")
return return
@ -67,7 +68,7 @@ func (client LoadBalancerFrontendIPConfigurationsClient) Get(resourceGroupName s
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client LoadBalancerFrontendIPConfigurationsClient) GetPreparer(resourceGroupName string, loadBalancerName string, frontendIPConfigurationName string) (*http.Request, error) { func (client LoadBalancerFrontendIPConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, frontendIPConfigurationName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"frontendIPConfigurationName": autorest.Encode("path", frontendIPConfigurationName), "frontendIPConfigurationName": autorest.Encode("path", frontendIPConfigurationName),
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
@ -85,14 +86,13 @@ func (client LoadBalancerFrontendIPConfigurationsClient) GetPreparer(resourceGro
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations/{frontendIPConfigurationName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations/{frontendIPConfigurationName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancerFrontendIPConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) { func (client LoadBalancerFrontendIPConfigurationsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -112,8 +112,9 @@ func (client LoadBalancerFrontendIPConfigurationsClient) GetResponder(resp *http
// List gets all the load balancer frontend IP configurations. // List gets all the load balancer frontend IP configurations.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
func (client LoadBalancerFrontendIPConfigurationsClient) List(resourceGroupName string, loadBalancerName string) (result LoadBalancerFrontendIPConfigurationListResult, err error) { func (client LoadBalancerFrontendIPConfigurationsClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerFrontendIPConfigurationListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, loadBalancerName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "List", nil, "Failure preparing request")
return return
@ -121,12 +122,12 @@ func (client LoadBalancerFrontendIPConfigurationsClient) List(resourceGroupName
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.lbficlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.lbficlr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "List", resp, "Failure responding to request")
} }
@ -135,7 +136,7 @@ func (client LoadBalancerFrontendIPConfigurationsClient) List(resourceGroupName
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client LoadBalancerFrontendIPConfigurationsClient) ListPreparer(resourceGroupName string, loadBalancerName string) (*http.Request, error) { func (client LoadBalancerFrontendIPConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -152,14 +153,13 @@ func (client LoadBalancerFrontendIPConfigurationsClient) ListPreparer(resourceGr
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/frontendIPConfigurations", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancerFrontendIPConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { func (client LoadBalancerFrontendIPConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -176,71 +176,29 @@ func (client LoadBalancerFrontendIPConfigurationsClient) ListResponder(resp *htt
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client LoadBalancerFrontendIPConfigurationsClient) ListNextResults(lastResults LoadBalancerFrontendIPConfigurationListResult) (result LoadBalancerFrontendIPConfigurationListResult, err error) { func (client LoadBalancerFrontendIPConfigurationsClient) listNextResults(lastResults LoadBalancerFrontendIPConfigurationListResult) (result LoadBalancerFrontendIPConfigurationListResult, err error) {
req, err := lastResults.LoadBalancerFrontendIPConfigurationListResultPreparer() req, err := lastResults.loadBalancerFrontendIPConfigurationListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.LoadBalancerFrontendIPConfigurationsClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client LoadBalancerFrontendIPConfigurationsClient) ListComplete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (<-chan FrontendIPConfiguration, <-chan error) { func (client LoadBalancerFrontendIPConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerFrontendIPConfigurationListResultIterator, err error) {
resultChan := make(chan FrontendIPConfiguration) result.page, err = client.List(ctx, resourceGroupName, loadBalancerName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, loadBalancerName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// LoadBalancerLoadBalancingRulesClient is the network Client // LoadBalancerLoadBalancingRulesClient is the network Client
type LoadBalancerLoadBalancingRulesClient struct { type LoadBalancerLoadBalancingRulesClient struct {
ManagementClient BaseClient
} }
// NewLoadBalancerLoadBalancingRulesClient creates an instance of the LoadBalancerLoadBalancingRulesClient client. // NewLoadBalancerLoadBalancingRulesClient creates an instance of the LoadBalancerLoadBalancingRulesClient client.
@ -43,8 +44,8 @@ func NewLoadBalancerLoadBalancingRulesClientWithBaseURI(baseURI string, subscrip
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
// loadBalancingRuleName is the name of the load balancing rule. // loadBalancingRuleName is the name of the load balancing rule.
func (client LoadBalancerLoadBalancingRulesClient) Get(resourceGroupName string, loadBalancerName string, loadBalancingRuleName string) (result LoadBalancingRule, err error) { func (client LoadBalancerLoadBalancingRulesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, loadBalancingRuleName string) (result LoadBalancingRule, err error) {
req, err := client.GetPreparer(resourceGroupName, loadBalancerName, loadBalancingRuleName) req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, loadBalancingRuleName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "Get", nil, "Failure preparing request")
return return
@ -66,7 +67,7 @@ func (client LoadBalancerLoadBalancingRulesClient) Get(resourceGroupName string,
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client LoadBalancerLoadBalancingRulesClient) GetPreparer(resourceGroupName string, loadBalancerName string, loadBalancingRuleName string) (*http.Request, error) { func (client LoadBalancerLoadBalancingRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, loadBalancingRuleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
"loadBalancingRuleName": autorest.Encode("path", loadBalancingRuleName), "loadBalancingRuleName": autorest.Encode("path", loadBalancingRuleName),
@ -84,14 +85,13 @@ func (client LoadBalancerLoadBalancingRulesClient) GetPreparer(resourceGroupName
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules/{loadBalancingRuleName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules/{loadBalancingRuleName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancerLoadBalancingRulesClient) GetSender(req *http.Request) (*http.Response, error) { func (client LoadBalancerLoadBalancingRulesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -111,8 +111,9 @@ func (client LoadBalancerLoadBalancingRulesClient) GetResponder(resp *http.Respo
// List gets all the load balancing rules in a load balancer. // List gets all the load balancing rules in a load balancer.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
func (client LoadBalancerLoadBalancingRulesClient) List(resourceGroupName string, loadBalancerName string) (result LoadBalancerLoadBalancingRuleListResult, err error) { func (client LoadBalancerLoadBalancingRulesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerLoadBalancingRuleListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, loadBalancerName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "List", nil, "Failure preparing request")
return return
@ -120,12 +121,12 @@ func (client LoadBalancerLoadBalancingRulesClient) List(resourceGroupName string
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.lblbrlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.lblbrlr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "List", resp, "Failure responding to request")
} }
@ -134,7 +135,7 @@ func (client LoadBalancerLoadBalancingRulesClient) List(resourceGroupName string
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client LoadBalancerLoadBalancingRulesClient) ListPreparer(resourceGroupName string, loadBalancerName string) (*http.Request, error) { func (client LoadBalancerLoadBalancingRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -151,14 +152,13 @@ func (client LoadBalancerLoadBalancingRulesClient) ListPreparer(resourceGroupNam
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/loadBalancingRules", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancerLoadBalancingRulesClient) ListSender(req *http.Request) (*http.Response, error) { func (client LoadBalancerLoadBalancingRulesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -175,71 +175,29 @@ func (client LoadBalancerLoadBalancingRulesClient) ListResponder(resp *http.Resp
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client LoadBalancerLoadBalancingRulesClient) ListNextResults(lastResults LoadBalancerLoadBalancingRuleListResult) (result LoadBalancerLoadBalancingRuleListResult, err error) { func (client LoadBalancerLoadBalancingRulesClient) listNextResults(lastResults LoadBalancerLoadBalancingRuleListResult) (result LoadBalancerLoadBalancingRuleListResult, err error) {
req, err := lastResults.LoadBalancerLoadBalancingRuleListResultPreparer() req, err := lastResults.loadBalancerLoadBalancingRuleListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.LoadBalancerLoadBalancingRulesClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client LoadBalancerLoadBalancingRulesClient) ListComplete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (<-chan LoadBalancingRule, <-chan error) { func (client LoadBalancerLoadBalancingRulesClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerLoadBalancingRuleListResultIterator, err error) {
resultChan := make(chan LoadBalancingRule) result.page, err = client.List(ctx, resourceGroupName, loadBalancerName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, loadBalancerName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// LoadBalancerNetworkInterfacesClient is the network Client // LoadBalancerNetworkInterfacesClient is the network Client
type LoadBalancerNetworkInterfacesClient struct { type LoadBalancerNetworkInterfacesClient struct {
ManagementClient BaseClient
} }
// NewLoadBalancerNetworkInterfacesClient creates an instance of the LoadBalancerNetworkInterfacesClient client. // NewLoadBalancerNetworkInterfacesClient creates an instance of the LoadBalancerNetworkInterfacesClient client.
@ -42,8 +43,9 @@ func NewLoadBalancerNetworkInterfacesClientWithBaseURI(baseURI string, subscript
// List gets associated load balancer network interfaces. // List gets associated load balancer network interfaces.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
func (client LoadBalancerNetworkInterfacesClient) List(resourceGroupName string, loadBalancerName string) (result InterfaceListResult, err error) { func (client LoadBalancerNetworkInterfacesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result InterfaceListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, loadBalancerName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "List", nil, "Failure preparing request")
return return
@ -51,12 +53,12 @@ func (client LoadBalancerNetworkInterfacesClient) List(resourceGroupName string,
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.ilr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.ilr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "List", resp, "Failure responding to request")
} }
@ -65,7 +67,7 @@ func (client LoadBalancerNetworkInterfacesClient) List(resourceGroupName string,
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client LoadBalancerNetworkInterfacesClient) ListPreparer(resourceGroupName string, loadBalancerName string) (*http.Request, error) { func (client LoadBalancerNetworkInterfacesClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -82,14 +84,13 @@ func (client LoadBalancerNetworkInterfacesClient) ListPreparer(resourceGroupName
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/networkInterfaces", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/networkInterfaces", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancerNetworkInterfacesClient) ListSender(req *http.Request) (*http.Response, error) { func (client LoadBalancerNetworkInterfacesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -106,71 +107,29 @@ func (client LoadBalancerNetworkInterfacesClient) ListResponder(resp *http.Respo
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client LoadBalancerNetworkInterfacesClient) ListNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) { func (client LoadBalancerNetworkInterfacesClient) listNextResults(lastResults InterfaceListResult) (result InterfaceListResult, err error) {
req, err := lastResults.InterfaceListResultPreparer() req, err := lastResults.interfaceListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.LoadBalancerNetworkInterfacesClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client LoadBalancerNetworkInterfacesClient) ListComplete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (<-chan Interface, <-chan error) { func (client LoadBalancerNetworkInterfacesClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result InterfaceListResultIterator, err error) {
resultChan := make(chan Interface) result.page, err = client.List(ctx, resourceGroupName, loadBalancerName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, loadBalancerName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// LoadBalancerProbesClient is the network Client // LoadBalancerProbesClient is the network Client
type LoadBalancerProbesClient struct { type LoadBalancerProbesClient struct {
ManagementClient BaseClient
} }
// NewLoadBalancerProbesClient creates an instance of the LoadBalancerProbesClient client. // NewLoadBalancerProbesClient creates an instance of the LoadBalancerProbesClient client.
@ -42,8 +43,8 @@ func NewLoadBalancerProbesClientWithBaseURI(baseURI string, subscriptionID strin
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. probeName is // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. probeName is
// the name of the probe. // the name of the probe.
func (client LoadBalancerProbesClient) Get(resourceGroupName string, loadBalancerName string, probeName string) (result Probe, err error) { func (client LoadBalancerProbesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, probeName string) (result Probe, err error) {
req, err := client.GetPreparer(resourceGroupName, loadBalancerName, probeName) req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, probeName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "Get", nil, "Failure preparing request")
return return
@ -65,7 +66,7 @@ func (client LoadBalancerProbesClient) Get(resourceGroupName string, loadBalance
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client LoadBalancerProbesClient) GetPreparer(resourceGroupName string, loadBalancerName string, probeName string) (*http.Request, error) { func (client LoadBalancerProbesClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, probeName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
"probeName": autorest.Encode("path", probeName), "probeName": autorest.Encode("path", probeName),
@ -83,14 +84,13 @@ func (client LoadBalancerProbesClient) GetPreparer(resourceGroupName string, loa
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancerProbesClient) GetSender(req *http.Request) (*http.Response, error) { func (client LoadBalancerProbesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -110,8 +110,9 @@ func (client LoadBalancerProbesClient) GetResponder(resp *http.Response) (result
// List gets all the load balancer probes. // List gets all the load balancer probes.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
func (client LoadBalancerProbesClient) List(resourceGroupName string, loadBalancerName string) (result LoadBalancerProbeListResult, err error) { func (client LoadBalancerProbesClient) List(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerProbeListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, loadBalancerName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, loadBalancerName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "List", nil, "Failure preparing request")
return return
@ -119,12 +120,12 @@ func (client LoadBalancerProbesClient) List(resourceGroupName string, loadBalanc
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.lbplr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.lbplr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "List", resp, "Failure responding to request")
} }
@ -133,7 +134,7 @@ func (client LoadBalancerProbesClient) List(resourceGroupName string, loadBalanc
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client LoadBalancerProbesClient) ListPreparer(resourceGroupName string, loadBalancerName string) (*http.Request, error) { func (client LoadBalancerProbesClient) ListPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -150,14 +151,13 @@ func (client LoadBalancerProbesClient) ListPreparer(resourceGroupName string, lo
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancerProbesClient) ListSender(req *http.Request) (*http.Response, error) { func (client LoadBalancerProbesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -174,71 +174,29 @@ func (client LoadBalancerProbesClient) ListResponder(resp *http.Response) (resul
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client LoadBalancerProbesClient) ListNextResults(lastResults LoadBalancerProbeListResult) (result LoadBalancerProbeListResult, err error) { func (client LoadBalancerProbesClient) listNextResults(lastResults LoadBalancerProbeListResult) (result LoadBalancerProbeListResult, err error) {
req, err := lastResults.LoadBalancerProbeListResultPreparer() req, err := lastResults.loadBalancerProbeListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.LoadBalancerProbesClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client LoadBalancerProbesClient) ListComplete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (<-chan Probe, <-chan error) { func (client LoadBalancerProbesClient) ListComplete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancerProbeListResultIterator, err error) {
resultChan := make(chan Probe) result.page, err = client.List(ctx, resourceGroupName, loadBalancerName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, loadBalancerName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// LoadBalancersClient is the network Client // LoadBalancersClient is the network Client
type LoadBalancersClient struct { type LoadBalancersClient struct {
ManagementClient BaseClient
} }
// NewLoadBalancersClient creates an instance of the LoadBalancersClient client. // NewLoadBalancersClient creates an instance of the LoadBalancersClient client.
@ -38,48 +39,28 @@ func NewLoadBalancersClientWithBaseURI(baseURI string, subscriptionID string) Lo
return LoadBalancersClient{NewWithBaseURI(baseURI, subscriptionID)} return LoadBalancersClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a load balancer. This method may poll for completion. Polling can be canceled by // CreateOrUpdate creates or updates a load balancer.
// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. parameters // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. parameters
// is parameters supplied to the create or update load balancer operation. // is parameters supplied to the create or update load balancer operation.
func (client LoadBalancersClient) CreateOrUpdate(resourceGroupName string, loadBalancerName string, parameters LoadBalancer, cancel <-chan struct{}) (<-chan LoadBalancer, <-chan error) { func (client LoadBalancersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters LoadBalancer) (result LoadBalancersCreateOrUpdateFuture, err error) {
resultChan := make(chan LoadBalancer, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, loadBalancerName, parameters)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", nil, "Failure preparing request")
var err error return
var result LoadBalancer }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, loadBalancerName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client LoadBalancersClient) CreateOrUpdatePreparer(resourceGroupName string, loadBalancerName string, parameters LoadBalancer, cancel <-chan struct{}) (*http.Request, error) { func (client LoadBalancersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters LoadBalancer) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -98,16 +79,22 @@ func (client LoadBalancersClient) CreateOrUpdatePreparer(resourceGroupName strin
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters),
autorest.WithJSON(parameters), autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client LoadBalancersClient) CreateOrUpdateSender(req *http.Request) (future LoadBalancersCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -116,54 +103,34 @@ func (client LoadBalancersClient) CreateOrUpdateResponder(resp *http.Response) (
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result), autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing()) autorest.ByClosing())
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return return
} }
// Delete deletes the specified load balancer. This method may poll for completion. Polling can be canceled by passing // Delete deletes the specified load balancer.
// the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer.
func (client LoadBalancersClient) Delete(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client LoadBalancersClient) Delete(ctx context.Context, resourceGroupName string, loadBalancerName string) (result LoadBalancersDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, loadBalancerName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, loadBalancerName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client LoadBalancersClient) DeletePreparer(resourceGroupName string, loadBalancerName string, cancel <-chan struct{}) (*http.Request, error) { func (client LoadBalancersClient) DeletePreparer(ctx context.Context, resourceGroupName string, loadBalancerName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -180,16 +147,22 @@ func (client LoadBalancersClient) DeletePreparer(resourceGroupName string, loadB
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancersClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client LoadBalancersClient) DeleteSender(req *http.Request) (future LoadBalancersDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -198,7 +171,7 @@ func (client LoadBalancersClient) DeleteResponder(resp *http.Response) (result a
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -208,8 +181,8 @@ func (client LoadBalancersClient) DeleteResponder(resp *http.Response) (result a
// //
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. expand is // resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. expand is
// expands referenced resources. // expands referenced resources.
func (client LoadBalancersClient) Get(resourceGroupName string, loadBalancerName string, expand string) (result LoadBalancer, err error) { func (client LoadBalancersClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, expand string) (result LoadBalancer, err error) {
req, err := client.GetPreparer(resourceGroupName, loadBalancerName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, loadBalancerName, expand)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "Get", nil, "Failure preparing request")
return return
@ -231,7 +204,7 @@ func (client LoadBalancersClient) Get(resourceGroupName string, loadBalancerName
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client LoadBalancersClient) GetPreparer(resourceGroupName string, loadBalancerName string, expand string) (*http.Request, error) { func (client LoadBalancersClient) GetPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"loadBalancerName": autorest.Encode("path", loadBalancerName), "loadBalancerName": autorest.Encode("path", loadBalancerName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -251,14 +224,13 @@ func (client LoadBalancersClient) GetPreparer(resourceGroupName string, loadBala
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancersClient) GetSender(req *http.Request) (*http.Response, error) { func (client LoadBalancersClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -278,8 +250,9 @@ func (client LoadBalancersClient) GetResponder(resp *http.Response) (result Load
// List gets all the load balancers in a resource group. // List gets all the load balancers in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client LoadBalancersClient) List(resourceGroupName string) (result LoadBalancerListResult, err error) { func (client LoadBalancersClient) List(ctx context.Context, resourceGroupName string) (result LoadBalancerListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", nil, "Failure preparing request")
return return
@ -287,12 +260,12 @@ func (client LoadBalancersClient) List(resourceGroupName string) (result LoadBal
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.lblr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.lblr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure responding to request")
} }
@ -301,7 +274,7 @@ func (client LoadBalancersClient) List(resourceGroupName string) (result LoadBal
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client LoadBalancersClient) ListPreparer(resourceGroupName string) (*http.Request, error) { func (client LoadBalancersClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -317,14 +290,13 @@ func (client LoadBalancersClient) ListPreparer(resourceGroupName string) (*http.
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancersClient) ListSender(req *http.Request) (*http.Response, error) { func (client LoadBalancersClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -341,78 +313,37 @@ func (client LoadBalancersClient) ListResponder(resp *http.Response) (result Loa
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client LoadBalancersClient) ListNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) { func (client LoadBalancersClient) listNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) {
req, err := lastResults.LoadBalancerListResultPreparer() req, err := lastResults.loadBalancerListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client LoadBalancersClient) ListComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan LoadBalancer, <-chan error) { func (client LoadBalancersClient) ListComplete(ctx context.Context, resourceGroupName string) (result LoadBalancerListResultIterator, err error) {
resultChan := make(chan LoadBalancer) result.page, err = client.List(ctx, resourceGroupName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
// ListAll gets all the load balancers in a subscription. // ListAll gets all the load balancers in a subscription.
func (client LoadBalancersClient) ListAll() (result LoadBalancerListResult, err error) { func (client LoadBalancersClient) ListAll(ctx context.Context) (result LoadBalancerListResultPage, err error) {
req, err := client.ListAllPreparer() result.fn = client.listAllNextResults
req, err := client.ListAllPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", nil, "Failure preparing request")
return return
@ -420,12 +351,12 @@ func (client LoadBalancersClient) ListAll() (result LoadBalancerListResult, err
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.lblr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure sending request")
return return
} }
result, err = client.ListAllResponder(resp) result.lblr, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure responding to request")
} }
@ -434,7 +365,7 @@ func (client LoadBalancersClient) ListAll() (result LoadBalancerListResult, err
} }
// ListAllPreparer prepares the ListAll request. // ListAllPreparer prepares the ListAll request.
func (client LoadBalancersClient) ListAllPreparer() (*http.Request, error) { func (client LoadBalancersClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
} }
@ -449,14 +380,13 @@ func (client LoadBalancersClient) ListAllPreparer() (*http.Request, error) {
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/loadBalancers", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListAllSender sends the ListAll request. The method will close the // ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LoadBalancersClient) ListAllSender(req *http.Request) (*http.Response, error) { func (client LoadBalancersClient) ListAllSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -473,71 +403,100 @@ func (client LoadBalancersClient) ListAllResponder(resp *http.Response) (result
return return
} }
// ListAllNextResults retrieves the next set of results, if any. // listAllNextResults retrieves the next set of results, if any.
func (client LoadBalancersClient) ListAllNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) { func (client LoadBalancersClient) listAllNextResults(lastResults LoadBalancerListResult) (result LoadBalancerListResult, err error) {
req, err := lastResults.LoadBalancerListResultPreparer() req, err := lastResults.loadBalancerListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "listAllNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.LoadBalancersClient", "listAllNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "ListAll", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "listAllNextResults", resp, "Failure responding to next results request")
}
return
}
// ListAllComplete enumerates all values, automatically crossing page boundaries as required.
func (client LoadBalancersClient) ListAllComplete(ctx context.Context) (result LoadBalancerListResultIterator, err error) {
result.page, err = client.ListAll(ctx)
return
}
// UpdateTags updates a load balancer tags.
//
// resourceGroupName is the name of the resource group. loadBalancerName is the name of the load balancer. parameters
// is parameters supplied to update load balancer tags.
func (client LoadBalancersClient) UpdateTags(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters TagsObject) (result LoadBalancersUpdateTagsFuture, err error) {
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, loadBalancerName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "UpdateTags", nil, "Failure preparing request")
return
}
result, err = client.UpdateTagsSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "network.LoadBalancersClient", "UpdateTags", result.Response(), "Failure sending request")
return
} }
return return
} }
// ListAllComplete gets all elements from the list without paging. // UpdateTagsPreparer prepares the UpdateTags request.
func (client LoadBalancersClient) ListAllComplete(cancel <-chan struct{}) (<-chan LoadBalancer, <-chan error) { func (client LoadBalancersClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, loadBalancerName string, parameters TagsObject) (*http.Request, error) {
resultChan := make(chan LoadBalancer) pathParameters := map[string]interface{}{
errChan := make(chan error, 1) "loadBalancerName": autorest.Encode("path", loadBalancerName),
go func() { "resourceGroupName": autorest.Encode("path", resourceGroupName),
defer func() { "subscriptionId": autorest.Encode("path", client.SubscriptionID),
close(resultChan) }
close(errChan)
}() const APIVersion = "2017-09-01"
list, err := client.ListAll() queryParameters := map[string]interface{}{
if err != nil { "api-version": APIVersion,
errChan <- err }
return
} preparer := autorest.CreatePreparer(
if list.Value != nil { autorest.AsJSON(),
for _, item := range *list.Value { autorest.AsPatch(),
select { autorest.WithBaseURL(client.BaseURI),
case <-cancel: autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}", pathParameters),
return autorest.WithJSON(parameters),
case resultChan <- item: autorest.WithQueryParameters(queryParameters))
// Intentionally left blank return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
}
} // UpdateTagsSender sends the UpdateTags request. The method will close the
for list.NextLink != nil { // http.Response Body if it receives an error.
list, err = client.ListAllNextResults(list) func (client LoadBalancersClient) UpdateTagsSender(req *http.Request) (future LoadBalancersUpdateTagsFuture, err error) {
if err != nil { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
errChan <- err future.Future = azure.NewFuture(req)
return future.req = req
} _, err = future.Done(sender)
if list.Value != nil { if err != nil {
for _, item := range *list.Value { return
select { }
case <-cancel: err = autorest.Respond(future.Response(),
return azure.WithErrorUnlessStatusCode(http.StatusOK))
case resultChan <- item: return
// Intentionally left blank }
}
} // UpdateTagsResponder handles the response to the UpdateTags request. The method always
} // closes the http.Response Body.
} func (client LoadBalancersClient) UpdateTagsResponder(resp *http.Response) (result LoadBalancer, err error) {
}() err = autorest.Respond(
return resultChan, errChan resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/autorest/validation"
@ -26,7 +27,7 @@ import (
// LocalNetworkGatewaysClient is the network Client // LocalNetworkGatewaysClient is the network Client
type LocalNetworkGatewaysClient struct { type LocalNetworkGatewaysClient struct {
ManagementClient BaseClient
} }
// NewLocalNetworkGatewaysClient creates an instance of the LocalNetworkGatewaysClient client. // NewLocalNetworkGatewaysClient creates an instance of the LocalNetworkGatewaysClient client.
@ -39,60 +40,36 @@ func NewLocalNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID str
return LocalNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)} return LocalNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a local network gateway in the specified resource group. This method may poll for // CreateOrUpdate creates or updates a local network gateway in the specified resource group.
// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. localNetworkGatewayName is the name of the local network // resourceGroupName is the name of the resource group. localNetworkGatewayName is the name of the local network
// gateway. parameters is parameters supplied to the create or update local network gateway operation. // gateway. parameters is parameters supplied to the create or update local network gateway operation.
func (client LocalNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, cancel <-chan struct{}) (<-chan LocalNetworkGateway, <-chan error) { func (client LocalNetworkGatewaysClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway) (result LocalNetworkGatewaysCreateOrUpdateFuture, err error) {
resultChan := make(chan LocalNetworkGateway, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: localNetworkGatewayName, {TargetValue: localNetworkGatewayName,
Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "parameters.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate") return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate")
close(errChan)
close(resultChan)
return resultChan, errChan
} }
go func() { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, localNetworkGatewayName, parameters)
var err error if err != nil {
var result LocalNetworkGateway err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
defer func() { return
if err != nil { }
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, localNetworkGatewayName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway, cancel <-chan struct{}) (*http.Request, error) { func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters LocalNetworkGateway) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -111,16 +88,22 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupNam
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters),
autorest.WithJSON(parameters), autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LocalNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client LocalNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (future LocalNetworkGatewaysCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -129,64 +112,41 @@ func (client LocalNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Resp
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result), autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing()) autorest.ByClosing())
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return return
} }
// Delete deletes the specified local network gateway. This method may poll for completion. Polling can be canceled by // Delete deletes the specified local network gateway.
// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. localNetworkGatewayName is the name of the local network // resourceGroupName is the name of the resource group. localNetworkGatewayName is the name of the local network
// gateway. // gateway.
func (client LocalNetworkGatewaysClient) Delete(resourceGroupName string, localNetworkGatewayName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client LocalNetworkGatewaysClient) Delete(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGatewaysDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: localNetworkGatewayName, {TargetValue: localNetworkGatewayName,
Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "Delete") return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "Delete")
close(errChan)
close(resultChan)
return resultChan, errChan
} }
go func() { req, err := client.DeletePreparer(ctx, resourceGroupName, localNetworkGatewayName)
var err error if err != nil {
var result autorest.Response err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", nil, "Failure preparing request")
defer func() { return
if err != nil { }
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, localNetworkGatewayName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client LocalNetworkGatewaysClient) DeletePreparer(resourceGroupName string, localNetworkGatewayName string, cancel <-chan struct{}) (*http.Request, error) { func (client LocalNetworkGatewaysClient) DeletePreparer(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -203,16 +163,22 @@ func (client LocalNetworkGatewaysClient) DeletePreparer(resourceGroupName string
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LocalNetworkGatewaysClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client LocalNetworkGatewaysClient) DeleteSender(req *http.Request) (future LocalNetworkGatewaysDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -221,7 +187,7 @@ func (client LocalNetworkGatewaysClient) DeleteResponder(resp *http.Response) (r
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -231,14 +197,14 @@ func (client LocalNetworkGatewaysClient) DeleteResponder(resp *http.Response) (r
// //
// resourceGroupName is the name of the resource group. localNetworkGatewayName is the name of the local network // resourceGroupName is the name of the resource group. localNetworkGatewayName is the name of the local network
// gateway. // gateway.
func (client LocalNetworkGatewaysClient) Get(resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGateway, err error) { func (client LocalNetworkGatewaysClient) Get(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (result LocalNetworkGateway, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: localNetworkGatewayName, {TargetValue: localNetworkGatewayName,
Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "Get") return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "Get")
} }
req, err := client.GetPreparer(resourceGroupName, localNetworkGatewayName) req, err := client.GetPreparer(ctx, resourceGroupName, localNetworkGatewayName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "Get", nil, "Failure preparing request")
return return
@ -260,7 +226,7 @@ func (client LocalNetworkGatewaysClient) Get(resourceGroupName string, localNetw
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client LocalNetworkGatewaysClient) GetPreparer(resourceGroupName string, localNetworkGatewayName string) (*http.Request, error) { func (client LocalNetworkGatewaysClient) GetPreparer(ctx context.Context, resourceGroupName string, localNetworkGatewayName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName), "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -277,14 +243,13 @@ func (client LocalNetworkGatewaysClient) GetPreparer(resourceGroupName string, l
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LocalNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) { func (client LocalNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -304,8 +269,9 @@ func (client LocalNetworkGatewaysClient) GetResponder(resp *http.Response) (resu
// List gets all the local network gateways in a resource group. // List gets all the local network gateways in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client LocalNetworkGatewaysClient) List(resourceGroupName string) (result LocalNetworkGatewayListResult, err error) { func (client LocalNetworkGatewaysClient) List(ctx context.Context, resourceGroupName string) (result LocalNetworkGatewayListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", nil, "Failure preparing request")
return return
@ -313,12 +279,12 @@ func (client LocalNetworkGatewaysClient) List(resourceGroupName string) (result
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.lnglr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.lnglr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure responding to request")
} }
@ -327,7 +293,7 @@ func (client LocalNetworkGatewaysClient) List(resourceGroupName string) (result
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client LocalNetworkGatewaysClient) ListPreparer(resourceGroupName string) (*http.Request, error) { func (client LocalNetworkGatewaysClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -343,14 +309,13 @@ func (client LocalNetworkGatewaysClient) ListPreparer(resourceGroupName string)
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client LocalNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) { func (client LocalNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -367,71 +332,106 @@ func (client LocalNetworkGatewaysClient) ListResponder(resp *http.Response) (res
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client LocalNetworkGatewaysClient) ListNextResults(lastResults LocalNetworkGatewayListResult) (result LocalNetworkGatewayListResult, err error) { func (client LocalNetworkGatewaysClient) listNextResults(lastResults LocalNetworkGatewayListResult) (result LocalNetworkGatewayListResult, err error) {
req, err := lastResults.LocalNetworkGatewayListResultPreparer() req, err := lastResults.localNetworkGatewayListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "listNextResults", resp, "Failure responding to next results request")
}
return
}
// ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client LocalNetworkGatewaysClient) ListComplete(ctx context.Context, resourceGroupName string) (result LocalNetworkGatewayListResultIterator, err error) {
result.page, err = client.List(ctx, resourceGroupName)
return
}
// UpdateTags updates a local network gateway tags.
//
// resourceGroupName is the name of the resource group. localNetworkGatewayName is the name of the local network
// gateway. parameters is parameters supplied to update local network gateway tags.
func (client LocalNetworkGatewaysClient) UpdateTags(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters TagsObject) (result LocalNetworkGatewaysUpdateTagsFuture, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: localNetworkGatewayName,
Constraints: []validation.Constraint{{Target: "localNetworkGatewayName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.LocalNetworkGatewaysClient", "UpdateTags")
}
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, localNetworkGatewayName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "UpdateTags", nil, "Failure preparing request")
return
}
result, err = client.UpdateTagsSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "network.LocalNetworkGatewaysClient", "UpdateTags", result.Response(), "Failure sending request")
return
} }
return return
} }
// ListComplete gets all elements from the list without paging. // UpdateTagsPreparer prepares the UpdateTags request.
func (client LocalNetworkGatewaysClient) ListComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan LocalNetworkGateway, <-chan error) { func (client LocalNetworkGatewaysClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, localNetworkGatewayName string, parameters TagsObject) (*http.Request, error) {
resultChan := make(chan LocalNetworkGateway) pathParameters := map[string]interface{}{
errChan := make(chan error, 1) "localNetworkGatewayName": autorest.Encode("path", localNetworkGatewayName),
go func() { "resourceGroupName": autorest.Encode("path", resourceGroupName),
defer func() { "subscriptionId": autorest.Encode("path", client.SubscriptionID),
close(resultChan) }
close(errChan)
}() const APIVersion = "2017-09-01"
list, err := client.List(resourceGroupName) queryParameters := map[string]interface{}{
if err != nil { "api-version": APIVersion,
errChan <- err }
return
} preparer := autorest.CreatePreparer(
if list.Value != nil { autorest.AsJSON(),
for _, item := range *list.Value { autorest.AsPatch(),
select { autorest.WithBaseURL(client.BaseURI),
case <-cancel: autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/localNetworkGateways/{localNetworkGatewayName}", pathParameters),
return autorest.WithJSON(parameters),
case resultChan <- item: autorest.WithQueryParameters(queryParameters))
// Intentionally left blank return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
}
} // UpdateTagsSender sends the UpdateTags request. The method will close the
for list.NextLink != nil { // http.Response Body if it receives an error.
list, err = client.ListNextResults(list) func (client LocalNetworkGatewaysClient) UpdateTagsSender(req *http.Request) (future LocalNetworkGatewaysUpdateTagsFuture, err error) {
if err != nil { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
errChan <- err future.Future = azure.NewFuture(req)
return future.req = req
} _, err = future.Done(sender)
if list.Value != nil { if err != nil {
for _, item := range *list.Value { return
select { }
case <-cancel: err = autorest.Respond(future.Response(),
return azure.WithErrorUnlessStatusCode(http.StatusOK))
case resultChan <- item: return
// Intentionally left blank }
}
} // UpdateTagsResponder handles the response to the UpdateTags request. The method always
} // closes the http.Response Body.
} func (client LocalNetworkGatewaysClient) UpdateTagsResponder(resp *http.Response) (result LocalNetworkGateway, err error) {
}() err = autorest.Respond(
return resultChan, errChan resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,126 @@
package network
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
)
// OperationsClient is the network Client
type OperationsClient struct {
BaseClient
}
// NewOperationsClient creates an instance of the OperationsClient client.
func NewOperationsClient(subscriptionID string) OperationsClient {
return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client.
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// List lists all of the available Network Rest API operations.
func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) {
result.fn = client.listNextResults
req, err := client.ListPreparer(ctx)
if err != nil {
err = autorest.NewErrorWithError(err, "network.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, "network.OperationsClient", "List", resp, "Failure sending request")
return
}
result.olr, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.OperationsClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) {
const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPath("/providers/Microsoft.Network/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 autorest.SendWithSender(client, 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,
client.ByInspecting(),
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(lastResults OperationListResult) (result OperationListResult, err error) {
req, err := lastResults.operationListResultPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "network.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, "network.OperationsClient", "listNextResults", resp, "Failure sending next results request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.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) {
result.page, err = client.List(ctx)
return
}

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/autorest/validation"
@ -26,7 +27,7 @@ import (
// PacketCapturesClient is the network Client // PacketCapturesClient is the network Client
type PacketCapturesClient struct { type PacketCapturesClient struct {
ManagementClient BaseClient
} }
// NewPacketCapturesClient creates an instance of the PacketCapturesClient client. // NewPacketCapturesClient creates an instance of the PacketCapturesClient client.
@ -39,62 +40,38 @@ func NewPacketCapturesClientWithBaseURI(baseURI string, subscriptionID string) P
return PacketCapturesClient{NewWithBaseURI(baseURI, subscriptionID)} return PacketCapturesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// Create create and start a packet capture on the specified VM. This method may poll for completion. Polling can be // Create create and start a packet capture on the specified VM.
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
// //
// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. // resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher.
// packetCaptureName is the name of the packet capture session. parameters is parameters that define the create packet // packetCaptureName is the name of the packet capture session. parameters is parameters that define the create packet
// capture operation. // capture operation.
func (client PacketCapturesClient) Create(resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, cancel <-chan struct{}) (<-chan PacketCaptureResult, <-chan error) { func (client PacketCapturesClient) Create(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture) (result PacketCapturesCreateFuture, err error) {
resultChan := make(chan PacketCaptureResult, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.PacketCaptureParameters", Name: validation.Null, Rule: true, Constraints: []validation.Constraint{{Target: "parameters.PacketCaptureParameters", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.PacketCaptureParameters.Target", Name: validation.Null, Rule: true, Chain: nil}, Chain: []validation.Constraint{{Target: "parameters.PacketCaptureParameters.Target", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.PacketCaptureParameters.StorageLocation", Name: validation.Null, Rule: true, Chain: nil}, {Target: "parameters.PacketCaptureParameters.StorageLocation", Name: validation.Null, Rule: true, Chain: nil},
}}}}}); err != nil { }}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "network.PacketCapturesClient", "Create") return result, validation.NewErrorWithValidationError(err, "network.PacketCapturesClient", "Create")
close(errChan)
close(resultChan)
return resultChan, errChan
} }
go func() { req, err := client.CreatePreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName, parameters)
var err error if err != nil {
var result PacketCaptureResult err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", nil, "Failure preparing request")
defer func() { return
if err != nil { }
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreatePreparer(resourceGroupName, networkWatcherName, packetCaptureName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", nil, "Failure preparing request")
return
}
resp, err := client.CreateSender(req) result, err = client.CreateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", resp, "Failure sending request") return
return }
}
result, err = client.CreateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Create", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreatePreparer prepares the Create request. // CreatePreparer prepares the Create request.
func (client PacketCapturesClient) CreatePreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, cancel <-chan struct{}) (*http.Request, error) { func (client PacketCapturesClient) CreatePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName), "networkWatcherName": autorest.Encode("path", networkWatcherName),
"packetCaptureName": autorest.Encode("path", packetCaptureName), "packetCaptureName": autorest.Encode("path", packetCaptureName),
@ -114,16 +91,22 @@ func (client PacketCapturesClient) CreatePreparer(resourceGroupName string, netw
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters),
autorest.WithJSON(parameters), autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateSender sends the Create request. The method will close the // CreateSender sends the Create request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PacketCapturesClient) CreateSender(req *http.Request) (*http.Response, error) { func (client PacketCapturesClient) CreateSender(req *http.Request) (future PacketCapturesCreateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateResponder handles the response to the Create request. The method always // CreateResponder handles the response to the Create request. The method always
@ -139,48 +122,28 @@ func (client PacketCapturesClient) CreateResponder(resp *http.Response) (result
return return
} }
// Delete deletes the specified packet capture session. This method may poll for completion. Polling can be canceled by // Delete deletes the specified packet capture session.
// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. // resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher.
// packetCaptureName is the name of the packet capture session. // packetCaptureName is the name of the packet capture session.
func (client PacketCapturesClient) Delete(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client PacketCapturesClient) Delete(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCapturesDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client PacketCapturesClient) DeletePreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { func (client PacketCapturesClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName), "networkWatcherName": autorest.Encode("path", networkWatcherName),
"packetCaptureName": autorest.Encode("path", packetCaptureName), "packetCaptureName": autorest.Encode("path", packetCaptureName),
@ -198,16 +161,22 @@ func (client PacketCapturesClient) DeletePreparer(resourceGroupName string, netw
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PacketCapturesClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client PacketCapturesClient) DeleteSender(req *http.Request) (future PacketCapturesDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -216,7 +185,7 @@ func (client PacketCapturesClient) DeleteResponder(resp *http.Response) (result
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -226,8 +195,8 @@ func (client PacketCapturesClient) DeleteResponder(resp *http.Response) (result
// //
// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. // resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher.
// packetCaptureName is the name of the packet capture session. // packetCaptureName is the name of the packet capture session.
func (client PacketCapturesClient) Get(resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCaptureResult, err error) { func (client PacketCapturesClient) Get(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCaptureResult, err error) {
req, err := client.GetPreparer(resourceGroupName, networkWatcherName, packetCaptureName) req, err := client.GetPreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Get", nil, "Failure preparing request")
return return
@ -249,7 +218,7 @@ func (client PacketCapturesClient) Get(resourceGroupName string, networkWatcherN
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client PacketCapturesClient) GetPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string) (*http.Request, error) { func (client PacketCapturesClient) GetPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName), "networkWatcherName": autorest.Encode("path", networkWatcherName),
"packetCaptureName": autorest.Encode("path", packetCaptureName), "packetCaptureName": autorest.Encode("path", packetCaptureName),
@ -267,14 +236,13 @@ func (client PacketCapturesClient) GetPreparer(resourceGroupName string, network
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PacketCapturesClient) GetSender(req *http.Request) (*http.Response, error) { func (client PacketCapturesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -291,49 +259,28 @@ func (client PacketCapturesClient) GetResponder(resp *http.Response) (result Pac
return return
} }
// GetStatus query the status of a running packet capture session. This method may poll for completion. Polling can be // GetStatus query the status of a running packet capture session.
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
// //
// resourceGroupName is the name of the resource group. networkWatcherName is the name of the Network Watcher resource. // resourceGroupName is the name of the resource group. networkWatcherName is the name of the Network Watcher resource.
// packetCaptureName is the name given to the packet capture session. // packetCaptureName is the name given to the packet capture session.
func (client PacketCapturesClient) GetStatus(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (<-chan PacketCaptureQueryStatusResult, <-chan error) { func (client PacketCapturesClient) GetStatus(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCapturesGetStatusFuture, err error) {
resultChan := make(chan PacketCaptureQueryStatusResult, 1) req, err := client.GetStatusPreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", nil, "Failure preparing request")
var err error return
var result PacketCaptureQueryStatusResult }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.GetStatusPreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", nil, "Failure preparing request")
return
}
resp, err := client.GetStatusSender(req) result, err = client.GetStatusSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", resp, "Failure sending request") return
return }
}
result, err = client.GetStatusResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "GetStatus", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// GetStatusPreparer prepares the GetStatus request. // GetStatusPreparer prepares the GetStatus request.
func (client PacketCapturesClient) GetStatusPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { func (client PacketCapturesClient) GetStatusPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName), "networkWatcherName": autorest.Encode("path", networkWatcherName),
"packetCaptureName": autorest.Encode("path", packetCaptureName), "packetCaptureName": autorest.Encode("path", packetCaptureName),
@ -351,16 +298,22 @@ func (client PacketCapturesClient) GetStatusPreparer(resourceGroupName string, n
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetStatusSender sends the GetStatus request. The method will close the // GetStatusSender sends the GetStatus request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PacketCapturesClient) GetStatusSender(req *http.Request) (*http.Response, error) { func (client PacketCapturesClient) GetStatusSender(req *http.Request) (future PacketCapturesGetStatusFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
return
} }
// GetStatusResponder handles the response to the GetStatus request. The method always // GetStatusResponder handles the response to the GetStatus request. The method always
@ -379,8 +332,8 @@ func (client PacketCapturesClient) GetStatusResponder(resp *http.Response) (resu
// List lists all packet capture sessions within the specified resource group. // List lists all packet capture sessions within the specified resource group.
// //
// resourceGroupName is the name of the resource group. networkWatcherName is the name of the Network Watcher resource. // resourceGroupName is the name of the resource group. networkWatcherName is the name of the Network Watcher resource.
func (client PacketCapturesClient) List(resourceGroupName string, networkWatcherName string) (result PacketCaptureListResult, err error) { func (client PacketCapturesClient) List(ctx context.Context, resourceGroupName string, networkWatcherName string) (result PacketCaptureListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, networkWatcherName) req, err := client.ListPreparer(ctx, resourceGroupName, networkWatcherName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "List", nil, "Failure preparing request")
return return
@ -402,7 +355,7 @@ func (client PacketCapturesClient) List(resourceGroupName string, networkWatcher
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client PacketCapturesClient) ListPreparer(resourceGroupName string, networkWatcherName string) (*http.Request, error) { func (client PacketCapturesClient) ListPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName), "networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -419,14 +372,13 @@ func (client PacketCapturesClient) ListPreparer(resourceGroupName string, networ
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PacketCapturesClient) ListSender(req *http.Request) (*http.Response, error) { func (client PacketCapturesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -443,48 +395,28 @@ func (client PacketCapturesClient) ListResponder(resp *http.Response) (result Pa
return return
} }
// Stop stops a specified packet capture session. This method may poll for completion. Polling can be canceled by // Stop stops a specified packet capture session.
// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher. // resourceGroupName is the name of the resource group. networkWatcherName is the name of the network watcher.
// packetCaptureName is the name of the packet capture session. // packetCaptureName is the name of the packet capture session.
func (client PacketCapturesClient) Stop(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client PacketCapturesClient) Stop(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCapturesStopFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.StopPreparer(ctx, resourceGroupName, networkWatcherName, packetCaptureName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.StopPreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", nil, "Failure preparing request")
return
}
resp, err := client.StopSender(req) result, err = client.StopSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", resp, "Failure sending request") return
return }
}
result, err = client.StopResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.PacketCapturesClient", "Stop", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// StopPreparer prepares the Stop request. // StopPreparer prepares the Stop request.
func (client PacketCapturesClient) StopPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) { func (client PacketCapturesClient) StopPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, packetCaptureName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName), "networkWatcherName": autorest.Encode("path", networkWatcherName),
"packetCaptureName": autorest.Encode("path", packetCaptureName), "packetCaptureName": autorest.Encode("path", packetCaptureName),
@ -502,16 +434,22 @@ func (client PacketCapturesClient) StopPreparer(resourceGroupName string, networ
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// StopSender sends the Stop request. The method will close the // StopSender sends the Stop request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PacketCapturesClient) StopSender(req *http.Request) (*http.Response, error) { func (client PacketCapturesClient) StopSender(req *http.Request) (future PacketCapturesStopFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
return
} }
// StopResponder handles the response to the Stop request. The method always // StopResponder handles the response to the Stop request. The method always

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/autorest/validation"
@ -26,7 +27,7 @@ import (
// PublicIPAddressesClient is the network Client // PublicIPAddressesClient is the network Client
type PublicIPAddressesClient struct { type PublicIPAddressesClient struct {
ManagementClient BaseClient
} }
// NewPublicIPAddressesClient creates an instance of the PublicIPAddressesClient client. // NewPublicIPAddressesClient creates an instance of the PublicIPAddressesClient client.
@ -39,15 +40,11 @@ func NewPublicIPAddressesClientWithBaseURI(baseURI string, subscriptionID string
return PublicIPAddressesClient{NewWithBaseURI(baseURI, subscriptionID)} return PublicIPAddressesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a static or dynamic public IP address. This method may poll for completion. // CreateOrUpdate creates or updates a static or dynamic public IP address.
// Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. publicIPAddressName is the name of the public IP address. // resourceGroupName is the name of the resource group. publicIPAddressName is the name of the public IP address.
// parameters is parameters supplied to the create or update public IP address operation. // parameters is parameters supplied to the create or update public IP address operation.
func (client PublicIPAddressesClient) CreateOrUpdate(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, cancel <-chan struct{}) (<-chan PublicIPAddress, <-chan error) { func (client PublicIPAddressesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress) (result PublicIPAddressesCreateOrUpdateFuture, err error) {
resultChan := make(chan PublicIPAddress, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false, Constraints: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat", Name: validation.Null, Rule: false,
@ -56,46 +53,26 @@ func (client PublicIPAddressesClient) CreateOrUpdate(resourceGroupName string, p
Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}}, Chain: []validation.Constraint{{Target: "parameters.PublicIPAddressPropertiesFormat.IPConfiguration.IPConfigurationPropertiesFormat.PublicIPAddress", Name: validation.Null, Rule: false, Chain: nil}}},
}}, }},
}}}}}); err != nil { }}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "network.PublicIPAddressesClient", "CreateOrUpdate") return result, validation.NewErrorWithValidationError(err, "network.PublicIPAddressesClient", "CreateOrUpdate")
close(errChan)
close(resultChan)
return resultChan, errChan
} }
go func() { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, publicIPAddressName, parameters)
var err error if err != nil {
var result PublicIPAddress err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", nil, "Failure preparing request")
defer func() { return
if err != nil { }
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, publicIPAddressName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client PublicIPAddressesClient) CreateOrUpdatePreparer(resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress, cancel <-chan struct{}) (*http.Request, error) { func (client PublicIPAddressesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters PublicIPAddress) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"publicIpAddressName": autorest.Encode("path", publicIPAddressName), "publicIpAddressName": autorest.Encode("path", publicIPAddressName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -114,16 +91,22 @@ func (client PublicIPAddressesClient) CreateOrUpdatePreparer(resourceGroupName s
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters),
autorest.WithJSON(parameters), autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PublicIPAddressesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client PublicIPAddressesClient) CreateOrUpdateSender(req *http.Request) (future PublicIPAddressesCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -132,54 +115,34 @@ func (client PublicIPAddressesClient) CreateOrUpdateResponder(resp *http.Respons
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result), autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing()) autorest.ByClosing())
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return return
} }
// Delete deletes the specified public IP address. This method may poll for completion. Polling can be canceled by // Delete deletes the specified public IP address.
// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. publicIPAddressName is the name of the subnet. // resourceGroupName is the name of the resource group. publicIPAddressName is the name of the subnet.
func (client PublicIPAddressesClient) Delete(resourceGroupName string, publicIPAddressName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client PublicIPAddressesClient) Delete(ctx context.Context, resourceGroupName string, publicIPAddressName string) (result PublicIPAddressesDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, publicIPAddressName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, publicIPAddressName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client PublicIPAddressesClient) DeletePreparer(resourceGroupName string, publicIPAddressName string, cancel <-chan struct{}) (*http.Request, error) { func (client PublicIPAddressesClient) DeletePreparer(ctx context.Context, resourceGroupName string, publicIPAddressName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"publicIpAddressName": autorest.Encode("path", publicIPAddressName), "publicIpAddressName": autorest.Encode("path", publicIPAddressName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -196,16 +159,22 @@ func (client PublicIPAddressesClient) DeletePreparer(resourceGroupName string, p
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PublicIPAddressesClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client PublicIPAddressesClient) DeleteSender(req *http.Request) (future PublicIPAddressesDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -214,7 +183,7 @@ func (client PublicIPAddressesClient) DeleteResponder(resp *http.Response) (resu
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -224,8 +193,8 @@ func (client PublicIPAddressesClient) DeleteResponder(resp *http.Response) (resu
// //
// resourceGroupName is the name of the resource group. publicIPAddressName is the name of the subnet. expand is // resourceGroupName is the name of the resource group. publicIPAddressName is the name of the subnet. expand is
// expands referenced resources. // expands referenced resources.
func (client PublicIPAddressesClient) Get(resourceGroupName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) { func (client PublicIPAddressesClient) Get(ctx context.Context, resourceGroupName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) {
req, err := client.GetPreparer(resourceGroupName, publicIPAddressName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, publicIPAddressName, expand)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "Get", nil, "Failure preparing request")
return return
@ -247,7 +216,7 @@ func (client PublicIPAddressesClient) Get(resourceGroupName string, publicIPAddr
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client PublicIPAddressesClient) GetPreparer(resourceGroupName string, publicIPAddressName string, expand string) (*http.Request, error) { func (client PublicIPAddressesClient) GetPreparer(ctx context.Context, resourceGroupName string, publicIPAddressName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"publicIpAddressName": autorest.Encode("path", publicIPAddressName), "publicIpAddressName": autorest.Encode("path", publicIPAddressName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -267,14 +236,13 @@ func (client PublicIPAddressesClient) GetPreparer(resourceGroupName string, publ
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PublicIPAddressesClient) GetSender(req *http.Request) (*http.Response, error) { func (client PublicIPAddressesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -297,8 +265,8 @@ func (client PublicIPAddressesClient) GetResponder(resp *http.Response) (result
// scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the network // scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the name of the network
// interface. IPConfigurationName is the name of the IP configuration. publicIPAddressName is the name of the public IP // interface. IPConfigurationName is the name of the IP configuration. publicIPAddressName is the name of the public IP
// Address. expand is expands referenced resources. // Address. expand is expands referenced resources.
func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddress(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) { func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddress(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (result PublicIPAddress, err error) {
req, err := client.GetVirtualMachineScaleSetPublicIPAddressPreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, publicIPAddressName, expand) req, err := client.GetVirtualMachineScaleSetPublicIPAddressPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName, publicIPAddressName, expand)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "GetVirtualMachineScaleSetPublicIPAddress", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "GetVirtualMachineScaleSetPublicIPAddress", nil, "Failure preparing request")
return return
@ -320,7 +288,7 @@ func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddress(r
} }
// GetVirtualMachineScaleSetPublicIPAddressPreparer prepares the GetVirtualMachineScaleSetPublicIPAddress request. // GetVirtualMachineScaleSetPublicIPAddressPreparer prepares the GetVirtualMachineScaleSetPublicIPAddress request.
func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddressPreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (*http.Request, error) { func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddressPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, publicIPAddressName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"ipConfigurationName": autorest.Encode("path", IPConfigurationName), "ipConfigurationName": autorest.Encode("path", IPConfigurationName),
"networkInterfaceName": autorest.Encode("path", networkInterfaceName), "networkInterfaceName": autorest.Encode("path", networkInterfaceName),
@ -344,14 +312,13 @@ func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddressPr
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetVirtualMachineScaleSetPublicIPAddressSender sends the GetVirtualMachineScaleSetPublicIPAddress request. The method will close the // GetVirtualMachineScaleSetPublicIPAddressSender sends the GetVirtualMachineScaleSetPublicIPAddress request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddressSender(req *http.Request) (*http.Response, error) { func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddressSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -371,8 +338,9 @@ func (client PublicIPAddressesClient) GetVirtualMachineScaleSetPublicIPAddressRe
// List gets all public IP addresses in a resource group. // List gets all public IP addresses in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client PublicIPAddressesClient) List(resourceGroupName string) (result PublicIPAddressListResult, err error) { func (client PublicIPAddressesClient) List(ctx context.Context, resourceGroupName string) (result PublicIPAddressListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", nil, "Failure preparing request")
return return
@ -380,12 +348,12 @@ func (client PublicIPAddressesClient) List(resourceGroupName string) (result Pub
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.pialr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.pialr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure responding to request")
} }
@ -394,7 +362,7 @@ func (client PublicIPAddressesClient) List(resourceGroupName string) (result Pub
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client PublicIPAddressesClient) ListPreparer(resourceGroupName string) (*http.Request, error) { func (client PublicIPAddressesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -410,14 +378,13 @@ func (client PublicIPAddressesClient) ListPreparer(resourceGroupName string) (*h
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PublicIPAddressesClient) ListSender(req *http.Request) (*http.Response, error) { func (client PublicIPAddressesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -434,78 +401,37 @@ func (client PublicIPAddressesClient) ListResponder(resp *http.Response) (result
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client PublicIPAddressesClient) ListNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { func (client PublicIPAddressesClient) listNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) {
req, err := lastResults.PublicIPAddressListResultPreparer() req, err := lastResults.publicIPAddressListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client PublicIPAddressesClient) ListComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan PublicIPAddress, <-chan error) { func (client PublicIPAddressesClient) ListComplete(ctx context.Context, resourceGroupName string) (result PublicIPAddressListResultIterator, err error) {
resultChan := make(chan PublicIPAddress) result.page, err = client.List(ctx, resourceGroupName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
// ListAll gets all the public IP addresses in a subscription. // ListAll gets all the public IP addresses in a subscription.
func (client PublicIPAddressesClient) ListAll() (result PublicIPAddressListResult, err error) { func (client PublicIPAddressesClient) ListAll(ctx context.Context) (result PublicIPAddressListResultPage, err error) {
req, err := client.ListAllPreparer() result.fn = client.listAllNextResults
req, err := client.ListAllPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", nil, "Failure preparing request")
return return
@ -513,12 +439,12 @@ func (client PublicIPAddressesClient) ListAll() (result PublicIPAddressListResul
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.pialr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure sending request")
return return
} }
result, err = client.ListAllResponder(resp) result.pialr, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure responding to request")
} }
@ -527,7 +453,7 @@ func (client PublicIPAddressesClient) ListAll() (result PublicIPAddressListResul
} }
// ListAllPreparer prepares the ListAll request. // ListAllPreparer prepares the ListAll request.
func (client PublicIPAddressesClient) ListAllPreparer() (*http.Request, error) { func (client PublicIPAddressesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
} }
@ -542,14 +468,13 @@ func (client PublicIPAddressesClient) ListAllPreparer() (*http.Request, error) {
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/publicIPAddresses", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListAllSender sends the ListAll request. The method will close the // ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PublicIPAddressesClient) ListAllSender(req *http.Request) (*http.Response, error) { func (client PublicIPAddressesClient) ListAllSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -566,73 +491,31 @@ func (client PublicIPAddressesClient) ListAllResponder(resp *http.Response) (res
return return
} }
// ListAllNextResults retrieves the next set of results, if any. // listAllNextResults retrieves the next set of results, if any.
func (client PublicIPAddressesClient) ListAllNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { func (client PublicIPAddressesClient) listAllNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) {
req, err := lastResults.PublicIPAddressListResultPreparer() req, err := lastResults.publicIPAddressListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listAllNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listAllNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListAll", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listAllNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListAllComplete gets all elements from the list without paging. // ListAllComplete enumerates all values, automatically crossing page boundaries as required.
func (client PublicIPAddressesClient) ListAllComplete(cancel <-chan struct{}) (<-chan PublicIPAddress, <-chan error) { func (client PublicIPAddressesClient) ListAllComplete(ctx context.Context) (result PublicIPAddressListResultIterator, err error) {
resultChan := make(chan PublicIPAddress) result.page, err = client.ListAll(ctx)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListAll()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListAllNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
// ListVirtualMachineScaleSetPublicIPAddresses gets information about all public IP addresses on a virtual machine // ListVirtualMachineScaleSetPublicIPAddresses gets information about all public IP addresses on a virtual machine
@ -640,8 +523,9 @@ func (client PublicIPAddressesClient) ListAllComplete(cancel <-chan struct{}) (<
// //
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine // resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine
// scale set. // scale set.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresses(resourceGroupName string, virtualMachineScaleSetName string) (result PublicIPAddressListResult, err error) { func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result PublicIPAddressListResultPage, err error) {
req, err := client.ListVirtualMachineScaleSetPublicIPAddressesPreparer(resourceGroupName, virtualMachineScaleSetName) result.fn = client.listVirtualMachineScaleSetPublicIPAddressesNextResults
req, err := client.ListVirtualMachineScaleSetPublicIPAddressesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetPublicIPAddresses", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetPublicIPAddresses", nil, "Failure preparing request")
return return
@ -649,12 +533,12 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresse
resp, err := client.ListVirtualMachineScaleSetPublicIPAddressesSender(req) resp, err := client.ListVirtualMachineScaleSetPublicIPAddressesSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.pialr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetPublicIPAddresses", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetPublicIPAddresses", resp, "Failure sending request")
return return
} }
result, err = client.ListVirtualMachineScaleSetPublicIPAddressesResponder(resp) result.pialr, err = client.ListVirtualMachineScaleSetPublicIPAddressesResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetPublicIPAddresses", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetPublicIPAddresses", resp, "Failure responding to request")
} }
@ -663,7 +547,7 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresse
} }
// ListVirtualMachineScaleSetPublicIPAddressesPreparer prepares the ListVirtualMachineScaleSetPublicIPAddresses request. // ListVirtualMachineScaleSetPublicIPAddressesPreparer prepares the ListVirtualMachineScaleSetPublicIPAddresses request.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddressesPreparer(resourceGroupName string, virtualMachineScaleSetName string) (*http.Request, error) { func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddressesPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -680,14 +564,13 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresse
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/publicipaddresses", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListVirtualMachineScaleSetPublicIPAddressesSender sends the ListVirtualMachineScaleSetPublicIPAddresses request. The method will close the // ListVirtualMachineScaleSetPublicIPAddressesSender sends the ListVirtualMachineScaleSetPublicIPAddresses request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddressesSender(req *http.Request) (*http.Response, error) { func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddressesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -704,73 +587,31 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresse
return return
} }
// ListVirtualMachineScaleSetPublicIPAddressesNextResults retrieves the next set of results, if any. // listVirtualMachineScaleSetPublicIPAddressesNextResults retrieves the next set of results, if any.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddressesNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { func (client PublicIPAddressesClient) listVirtualMachineScaleSetPublicIPAddressesNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) {
req, err := lastResults.PublicIPAddressListResultPreparer() req, err := lastResults.publicIPAddressListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetPublicIPAddresses", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listVirtualMachineScaleSetPublicIPAddressesNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListVirtualMachineScaleSetPublicIPAddressesSender(req) resp, err := client.ListVirtualMachineScaleSetPublicIPAddressesSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetPublicIPAddresses", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listVirtualMachineScaleSetPublicIPAddressesNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListVirtualMachineScaleSetPublicIPAddressesResponder(resp) result, err = client.ListVirtualMachineScaleSetPublicIPAddressesResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetPublicIPAddresses", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listVirtualMachineScaleSetPublicIPAddressesNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListVirtualMachineScaleSetPublicIPAddressesComplete gets all elements from the list without paging. // ListVirtualMachineScaleSetPublicIPAddressesComplete enumerates all values, automatically crossing page boundaries as required.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddressesComplete(resourceGroupName string, virtualMachineScaleSetName string, cancel <-chan struct{}) (<-chan PublicIPAddress, <-chan error) { func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddressesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string) (result PublicIPAddressListResultIterator, err error) {
resultChan := make(chan PublicIPAddress) result.page, err = client.ListVirtualMachineScaleSetPublicIPAddresses(ctx, resourceGroupName, virtualMachineScaleSetName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListVirtualMachineScaleSetPublicIPAddresses(resourceGroupName, virtualMachineScaleSetName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListVirtualMachineScaleSetPublicIPAddressesNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
// ListVirtualMachineScaleSetVMPublicIPAddresses gets information about all public IP addresses in a virtual machine IP // ListVirtualMachineScaleSetVMPublicIPAddresses gets information about all public IP addresses in a virtual machine IP
@ -779,8 +620,9 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetPublicIPAddresse
// resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine // resourceGroupName is the name of the resource group. virtualMachineScaleSetName is the name of the virtual machine
// scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the network interface name. // scale set. virtualmachineIndex is the virtual machine index. networkInterfaceName is the network interface name.
// IPConfigurationName is the IP configuration name. // IPConfigurationName is the IP configuration name.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddresses(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (result PublicIPAddressListResult, err error) { func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddresses(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (result PublicIPAddressListResultPage, err error) {
req, err := client.ListVirtualMachineScaleSetVMPublicIPAddressesPreparer(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName) result.fn = client.listVirtualMachineScaleSetVMPublicIPAddressesNextResults
req, err := client.ListVirtualMachineScaleSetVMPublicIPAddressesPreparer(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetVMPublicIPAddresses", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetVMPublicIPAddresses", nil, "Failure preparing request")
return return
@ -788,12 +630,12 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddres
resp, err := client.ListVirtualMachineScaleSetVMPublicIPAddressesSender(req) resp, err := client.ListVirtualMachineScaleSetVMPublicIPAddressesSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.pialr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetVMPublicIPAddresses", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetVMPublicIPAddresses", resp, "Failure sending request")
return return
} }
result, err = client.ListVirtualMachineScaleSetVMPublicIPAddressesResponder(resp) result.pialr, err = client.ListVirtualMachineScaleSetVMPublicIPAddressesResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetVMPublicIPAddresses", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetVMPublicIPAddresses", resp, "Failure responding to request")
} }
@ -802,7 +644,7 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddres
} }
// ListVirtualMachineScaleSetVMPublicIPAddressesPreparer prepares the ListVirtualMachineScaleSetVMPublicIPAddresses request. // ListVirtualMachineScaleSetVMPublicIPAddressesPreparer prepares the ListVirtualMachineScaleSetVMPublicIPAddresses request.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddressesPreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (*http.Request, error) { func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddressesPreparer(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"ipConfigurationName": autorest.Encode("path", IPConfigurationName), "ipConfigurationName": autorest.Encode("path", IPConfigurationName),
"networkInterfaceName": autorest.Encode("path", networkInterfaceName), "networkInterfaceName": autorest.Encode("path", networkInterfaceName),
@ -822,14 +664,13 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddres
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListVirtualMachineScaleSetVMPublicIPAddressesSender sends the ListVirtualMachineScaleSetVMPublicIPAddresses request. The method will close the // ListVirtualMachineScaleSetVMPublicIPAddressesSender sends the ListVirtualMachineScaleSetVMPublicIPAddresses request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddressesSender(req *http.Request) (*http.Response, error) { func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddressesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -846,71 +687,100 @@ func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddres
return return
} }
// ListVirtualMachineScaleSetVMPublicIPAddressesNextResults retrieves the next set of results, if any. // listVirtualMachineScaleSetVMPublicIPAddressesNextResults retrieves the next set of results, if any.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddressesNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) { func (client PublicIPAddressesClient) listVirtualMachineScaleSetVMPublicIPAddressesNextResults(lastResults PublicIPAddressListResult) (result PublicIPAddressListResult, err error) {
req, err := lastResults.PublicIPAddressListResultPreparer() req, err := lastResults.publicIPAddressListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetVMPublicIPAddresses", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listVirtualMachineScaleSetVMPublicIPAddressesNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListVirtualMachineScaleSetVMPublicIPAddressesSender(req) resp, err := client.ListVirtualMachineScaleSetVMPublicIPAddressesSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetVMPublicIPAddresses", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listVirtualMachineScaleSetVMPublicIPAddressesNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListVirtualMachineScaleSetVMPublicIPAddressesResponder(resp) result, err = client.ListVirtualMachineScaleSetVMPublicIPAddressesResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "ListVirtualMachineScaleSetVMPublicIPAddresses", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "listVirtualMachineScaleSetVMPublicIPAddressesNextResults", resp, "Failure responding to next results request")
}
return
}
// ListVirtualMachineScaleSetVMPublicIPAddressesComplete enumerates all values, automatically crossing page boundaries as required.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddressesComplete(ctx context.Context, resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string) (result PublicIPAddressListResultIterator, err error) {
result.page, err = client.ListVirtualMachineScaleSetVMPublicIPAddresses(ctx, resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName)
return
}
// UpdateTags updates public IP address tags.
//
// resourceGroupName is the name of the resource group. publicIPAddressName is the name of the public IP address.
// parameters is parameters supplied to update public IP address tags.
func (client PublicIPAddressesClient) UpdateTags(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters TagsObject) (result PublicIPAddressesUpdateTagsFuture, err error) {
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, publicIPAddressName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "UpdateTags", nil, "Failure preparing request")
return
}
result, err = client.UpdateTagsSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "network.PublicIPAddressesClient", "UpdateTags", result.Response(), "Failure sending request")
return
} }
return return
} }
// ListVirtualMachineScaleSetVMPublicIPAddressesComplete gets all elements from the list without paging. // UpdateTagsPreparer prepares the UpdateTags request.
func (client PublicIPAddressesClient) ListVirtualMachineScaleSetVMPublicIPAddressesComplete(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, IPConfigurationName string, cancel <-chan struct{}) (<-chan PublicIPAddress, <-chan error) { func (client PublicIPAddressesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, publicIPAddressName string, parameters TagsObject) (*http.Request, error) {
resultChan := make(chan PublicIPAddress) pathParameters := map[string]interface{}{
errChan := make(chan error, 1) "publicIpAddressName": autorest.Encode("path", publicIPAddressName),
go func() { "resourceGroupName": autorest.Encode("path", resourceGroupName),
defer func() { "subscriptionId": autorest.Encode("path", client.SubscriptionID),
close(resultChan) }
close(errChan)
}() const APIVersion = "2017-09-01"
list, err := client.ListVirtualMachineScaleSetVMPublicIPAddresses(resourceGroupName, virtualMachineScaleSetName, virtualmachineIndex, networkInterfaceName, IPConfigurationName) queryParameters := map[string]interface{}{
if err != nil { "api-version": APIVersion,
errChan <- err }
return
} preparer := autorest.CreatePreparer(
if list.Value != nil { autorest.AsJSON(),
for _, item := range *list.Value { autorest.AsPatch(),
select { autorest.WithBaseURL(client.BaseURI),
case <-cancel: autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPAddresses/{publicIpAddressName}", pathParameters),
return autorest.WithJSON(parameters),
case resultChan <- item: autorest.WithQueryParameters(queryParameters))
// Intentionally left blank return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
}
} // UpdateTagsSender sends the UpdateTags request. The method will close the
for list.NextLink != nil { // http.Response Body if it receives an error.
list, err = client.ListVirtualMachineScaleSetVMPublicIPAddressesNextResults(list) func (client PublicIPAddressesClient) UpdateTagsSender(req *http.Request) (future PublicIPAddressesUpdateTagsFuture, err error) {
if err != nil { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
errChan <- err future.Future = azure.NewFuture(req)
return future.req = req
} _, err = future.Done(sender)
if list.Value != nil { if err != nil {
for _, item := range *list.Value { return
select { }
case <-cancel: err = autorest.Respond(future.Response(),
return azure.WithErrorUnlessStatusCode(http.StatusOK))
case resultChan <- item: return
// Intentionally left blank }
}
} // UpdateTagsResponder handles the response to the UpdateTags request. The method always
} // closes the http.Response Body.
} func (client PublicIPAddressesClient) UpdateTagsResponder(resp *http.Response) (result PublicIPAddress, err error) {
}() err = autorest.Respond(
return resultChan, errChan resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/autorest/validation"
@ -26,7 +27,7 @@ import (
// RouteFilterRulesClient is the network Client // RouteFilterRulesClient is the network Client
type RouteFilterRulesClient struct { type RouteFilterRulesClient struct {
ManagementClient BaseClient
} }
// NewRouteFilterRulesClient creates an instance of the RouteFilterRulesClient client. // NewRouteFilterRulesClient creates an instance of the RouteFilterRulesClient client.
@ -39,62 +40,38 @@ func NewRouteFilterRulesClientWithBaseURI(baseURI string, subscriptionID string)
return RouteFilterRulesClient{NewWithBaseURI(baseURI, subscriptionID)} return RouteFilterRulesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a route in the specified route filter. This method may poll for completion. // CreateOrUpdate creates or updates a route in the specified route filter.
// Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName is // resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName is
// the name of the route filter rule. routeFilterRuleParameters is parameters supplied to the create or update route // the name of the route filter rule. routeFilterRuleParameters is parameters supplied to the create or update route
// filter rule operation. // filter rule operation.
func (client RouteFilterRulesClient) CreateOrUpdate(resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule, cancel <-chan struct{}) (<-chan RouteFilterRule, <-chan error) { func (client RouteFilterRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule) (result RouteFilterRulesCreateOrUpdateFuture, err error) {
resultChan := make(chan RouteFilterRule, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: routeFilterRuleParameters, {TargetValue: routeFilterRuleParameters,
Constraints: []validation.Constraint{{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat", Name: validation.Null, Rule: false, Constraints: []validation.Constraint{{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.RouteFilterRuleType", Name: validation.Null, Rule: true, Chain: nil}, Chain: []validation.Constraint{{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.RouteFilterRuleType", Name: validation.Null, Rule: true, Chain: nil},
{Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.Communities", Name: validation.Null, Rule: true, Chain: nil}, {Target: "routeFilterRuleParameters.RouteFilterRulePropertiesFormat.Communities", Name: validation.Null, Rule: true, Chain: nil},
}}}}}); err != nil { }}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "network.RouteFilterRulesClient", "CreateOrUpdate") return result, validation.NewErrorWithValidationError(err, "network.RouteFilterRulesClient", "CreateOrUpdate")
close(errChan)
close(resultChan)
return resultChan, errChan
} }
go func() { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters)
var err error if err != nil {
var result RouteFilterRule err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", nil, "Failure preparing request")
defer func() { return
if err != nil { }
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client RouteFilterRulesClient) CreateOrUpdatePreparer(resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule, cancel <-chan struct{}) (*http.Request, error) { func (client RouteFilterRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters RouteFilterRule) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeFilterName": autorest.Encode("path", routeFilterName), "routeFilterName": autorest.Encode("path", routeFilterName),
@ -114,16 +91,22 @@ func (client RouteFilterRulesClient) CreateOrUpdatePreparer(resourceGroupName st
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters),
autorest.WithJSON(routeFilterRuleParameters), autorest.WithJSON(routeFilterRuleParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteFilterRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client RouteFilterRulesClient) CreateOrUpdateSender(req *http.Request) (future RouteFilterRulesCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -139,49 +122,28 @@ func (client RouteFilterRulesClient) CreateOrUpdateResponder(resp *http.Response
return return
} }
// Delete deletes the specified rule from a route filter. This method may poll for completion. Polling can be canceled // Delete deletes the specified rule from a route filter.
// by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
// //
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName is // resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName is
// the name of the rule. // the name of the rule.
func (client RouteFilterRulesClient) Delete(resourceGroupName string, routeFilterName string, ruleName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client RouteFilterRulesClient) Delete(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRulesDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, routeFilterName, ruleName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, routeFilterName, ruleName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client RouteFilterRulesClient) DeletePreparer(resourceGroupName string, routeFilterName string, ruleName string, cancel <-chan struct{}) (*http.Request, error) { func (client RouteFilterRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeFilterName": autorest.Encode("path", routeFilterName), "routeFilterName": autorest.Encode("path", routeFilterName),
@ -199,16 +161,22 @@ func (client RouteFilterRulesClient) DeletePreparer(resourceGroupName string, ro
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteFilterRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client RouteFilterRulesClient) DeleteSender(req *http.Request) (future RouteFilterRulesDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -217,7 +185,7 @@ func (client RouteFilterRulesClient) DeleteResponder(resp *http.Response) (resul
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -227,8 +195,8 @@ func (client RouteFilterRulesClient) DeleteResponder(resp *http.Response) (resul
// //
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName is // resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName is
// the name of the rule. // the name of the rule.
func (client RouteFilterRulesClient) Get(resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRule, err error) { func (client RouteFilterRulesClient) Get(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (result RouteFilterRule, err error) {
req, err := client.GetPreparer(resourceGroupName, routeFilterName, ruleName) req, err := client.GetPreparer(ctx, resourceGroupName, routeFilterName, ruleName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Get", nil, "Failure preparing request")
return return
@ -250,7 +218,7 @@ func (client RouteFilterRulesClient) Get(resourceGroupName string, routeFilterNa
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client RouteFilterRulesClient) GetPreparer(resourceGroupName string, routeFilterName string, ruleName string) (*http.Request, error) { func (client RouteFilterRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeFilterName": autorest.Encode("path", routeFilterName), "routeFilterName": autorest.Encode("path", routeFilterName),
@ -268,14 +236,13 @@ func (client RouteFilterRulesClient) GetPreparer(resourceGroupName string, route
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteFilterRulesClient) GetSender(req *http.Request) (*http.Response, error) { func (client RouteFilterRulesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -295,8 +262,9 @@ func (client RouteFilterRulesClient) GetResponder(resp *http.Response) (result R
// ListByRouteFilter gets all RouteFilterRules in a route filter. // ListByRouteFilter gets all RouteFilterRules in a route filter.
// //
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. // resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter.
func (client RouteFilterRulesClient) ListByRouteFilter(resourceGroupName string, routeFilterName string) (result RouteFilterRuleListResult, err error) { func (client RouteFilterRulesClient) ListByRouteFilter(ctx context.Context, resourceGroupName string, routeFilterName string) (result RouteFilterRuleListResultPage, err error) {
req, err := client.ListByRouteFilterPreparer(resourceGroupName, routeFilterName) result.fn = client.listByRouteFilterNextResults
req, err := client.ListByRouteFilterPreparer(ctx, resourceGroupName, routeFilterName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", nil, "Failure preparing request")
return return
@ -304,12 +272,12 @@ func (client RouteFilterRulesClient) ListByRouteFilter(resourceGroupName string,
resp, err := client.ListByRouteFilterSender(req) resp, err := client.ListByRouteFilterSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.rfrlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure sending request")
return return
} }
result, err = client.ListByRouteFilterResponder(resp) result.rfrlr, err = client.ListByRouteFilterResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure responding to request")
} }
@ -318,7 +286,7 @@ func (client RouteFilterRulesClient) ListByRouteFilter(resourceGroupName string,
} }
// ListByRouteFilterPreparer prepares the ListByRouteFilter request. // ListByRouteFilterPreparer prepares the ListByRouteFilter request.
func (client RouteFilterRulesClient) ListByRouteFilterPreparer(resourceGroupName string, routeFilterName string) (*http.Request, error) { func (client RouteFilterRulesClient) ListByRouteFilterPreparer(ctx context.Context, resourceGroupName string, routeFilterName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeFilterName": autorest.Encode("path", routeFilterName), "routeFilterName": autorest.Encode("path", routeFilterName),
@ -335,14 +303,13 @@ func (client RouteFilterRulesClient) ListByRouteFilterPreparer(resourceGroupName
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListByRouteFilterSender sends the ListByRouteFilter request. The method will close the // ListByRouteFilterSender sends the ListByRouteFilter request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteFilterRulesClient) ListByRouteFilterSender(req *http.Request) (*http.Response, error) { func (client RouteFilterRulesClient) ListByRouteFilterSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -359,119 +326,56 @@ func (client RouteFilterRulesClient) ListByRouteFilterResponder(resp *http.Respo
return return
} }
// ListByRouteFilterNextResults retrieves the next set of results, if any. // listByRouteFilterNextResults retrieves the next set of results, if any.
func (client RouteFilterRulesClient) ListByRouteFilterNextResults(lastResults RouteFilterRuleListResult) (result RouteFilterRuleListResult, err error) { func (client RouteFilterRulesClient) listByRouteFilterNextResults(lastResults RouteFilterRuleListResult) (result RouteFilterRuleListResult, err error) {
req, err := lastResults.RouteFilterRuleListResultPreparer() req, err := lastResults.routeFilterRuleListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "listByRouteFilterNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListByRouteFilterSender(req) resp, err := client.ListByRouteFilterSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "listByRouteFilterNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListByRouteFilterResponder(resp) result, err = client.ListByRouteFilterResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "ListByRouteFilter", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "listByRouteFilterNextResults", resp, "Failure responding to next results request")
}
return
}
// ListByRouteFilterComplete enumerates all values, automatically crossing page boundaries as required.
func (client RouteFilterRulesClient) ListByRouteFilterComplete(ctx context.Context, resourceGroupName string, routeFilterName string) (result RouteFilterRuleListResultIterator, err error) {
result.page, err = client.ListByRouteFilter(ctx, resourceGroupName, routeFilterName)
return
}
// Update updates a route in the specified route filter.
//
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName is
// the name of the route filter rule. routeFilterRuleParameters is parameters supplied to the update route filter rule
// operation.
func (client RouteFilterRulesClient) Update(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters PatchRouteFilterRule) (result RouteFilterRulesUpdateFuture, err error) {
req, err := client.UpdatePreparer(ctx, resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Update", nil, "Failure preparing request")
return
}
result, err = client.UpdateSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Update", result.Response(), "Failure sending request")
return
} }
return return
} }
// ListByRouteFilterComplete gets all elements from the list without paging.
func (client RouteFilterRulesClient) ListByRouteFilterComplete(resourceGroupName string, routeFilterName string, cancel <-chan struct{}) (<-chan RouteFilterRule, <-chan error) {
resultChan := make(chan RouteFilterRule)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListByRouteFilter(resourceGroupName, routeFilterName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListByRouteFilterNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// Update updates a route in the specified route filter. This method may poll for completion. Polling can be canceled
// by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. ruleName is
// the name of the route filter rule. routeFilterRuleParameters is parameters supplied to the update route filter rule
// operation.
func (client RouteFilterRulesClient) Update(resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters PatchRouteFilterRule, cancel <-chan struct{}) (<-chan RouteFilterRule, <-chan error) {
resultChan := make(chan RouteFilterRule, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result RouteFilterRule
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.UpdatePreparer(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFilterRulesClient", "Update", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// UpdatePreparer prepares the Update request. // UpdatePreparer prepares the Update request.
func (client RouteFilterRulesClient) UpdatePreparer(resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters PatchRouteFilterRule, cancel <-chan struct{}) (*http.Request, error) { func (client RouteFilterRulesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, routeFilterName string, ruleName string, routeFilterRuleParameters PatchRouteFilterRule) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeFilterName": autorest.Encode("path", routeFilterName), "routeFilterName": autorest.Encode("path", routeFilterName),
@ -491,16 +395,22 @@ func (client RouteFilterRulesClient) UpdatePreparer(resourceGroupName string, ro
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}/routeFilterRules/{ruleName}", pathParameters),
autorest.WithJSON(routeFilterRuleParameters), autorest.WithJSON(routeFilterRuleParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// UpdateSender sends the Update request. The method will close the // UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteFilterRulesClient) UpdateSender(req *http.Request) (*http.Response, error) { func (client RouteFilterRulesClient) UpdateSender(req *http.Request) (future RouteFilterRulesUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK))
return
} }
// UpdateResponder handles the response to the Update request. The method always // UpdateResponder handles the response to the Update request. The method always

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// RouteFiltersClient is the network Client // RouteFiltersClient is the network Client
type RouteFiltersClient struct { type RouteFiltersClient struct {
ManagementClient BaseClient
} }
// NewRouteFiltersClient creates an instance of the RouteFiltersClient client. // NewRouteFiltersClient creates an instance of the RouteFiltersClient client.
@ -38,49 +39,28 @@ func NewRouteFiltersClientWithBaseURI(baseURI string, subscriptionID string) Rou
return RouteFiltersClient{NewWithBaseURI(baseURI, subscriptionID)} return RouteFiltersClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a route filter in a specified resource group. This method may poll for completion. // CreateOrUpdate creates or updates a route filter in a specified resource group.
// Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. // resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter.
// routeFilterParameters is parameters supplied to the create or update route filter operation. // routeFilterParameters is parameters supplied to the create or update route filter operation.
func (client RouteFiltersClient) CreateOrUpdate(resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter, cancel <-chan struct{}) (<-chan RouteFilter, <-chan error) { func (client RouteFiltersClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter) (result RouteFiltersCreateOrUpdateFuture, err error) {
resultChan := make(chan RouteFilter, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeFilterName, routeFilterParameters)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", nil, "Failure preparing request")
var err error return
var result RouteFilter }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeFilterName, routeFilterParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client RouteFiltersClient) CreateOrUpdatePreparer(resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter, cancel <-chan struct{}) (*http.Request, error) { func (client RouteFiltersClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters RouteFilter) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeFilterName": autorest.Encode("path", routeFilterName), "routeFilterName": autorest.Encode("path", routeFilterName),
@ -99,16 +79,22 @@ func (client RouteFiltersClient) CreateOrUpdatePreparer(resourceGroupName string
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters),
autorest.WithJSON(routeFilterParameters), autorest.WithJSON(routeFilterParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteFiltersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client RouteFiltersClient) CreateOrUpdateSender(req *http.Request) (future RouteFiltersCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -124,47 +110,27 @@ func (client RouteFiltersClient) CreateOrUpdateResponder(resp *http.Response) (r
return return
} }
// Delete deletes the specified route filter. This method may poll for completion. Polling can be canceled by passing // Delete deletes the specified route filter.
// the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. // resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter.
func (client RouteFiltersClient) Delete(resourceGroupName string, routeFilterName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client RouteFiltersClient) Delete(ctx context.Context, resourceGroupName string, routeFilterName string) (result RouteFiltersDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, routeFilterName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, routeFilterName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client RouteFiltersClient) DeletePreparer(resourceGroupName string, routeFilterName string, cancel <-chan struct{}) (*http.Request, error) { func (client RouteFiltersClient) DeletePreparer(ctx context.Context, resourceGroupName string, routeFilterName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeFilterName": autorest.Encode("path", routeFilterName), "routeFilterName": autorest.Encode("path", routeFilterName),
@ -181,16 +147,22 @@ func (client RouteFiltersClient) DeletePreparer(resourceGroupName string, routeF
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteFiltersClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client RouteFiltersClient) DeleteSender(req *http.Request) (future RouteFiltersDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -199,7 +171,7 @@ func (client RouteFiltersClient) DeleteResponder(resp *http.Response) (result au
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -209,8 +181,8 @@ func (client RouteFiltersClient) DeleteResponder(resp *http.Response) (result au
// //
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. expand is // resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter. expand is
// expands referenced express route bgp peering resources. // expands referenced express route bgp peering resources.
func (client RouteFiltersClient) Get(resourceGroupName string, routeFilterName string, expand string) (result RouteFilter, err error) { func (client RouteFiltersClient) Get(ctx context.Context, resourceGroupName string, routeFilterName string, expand string) (result RouteFilter, err error) {
req, err := client.GetPreparer(resourceGroupName, routeFilterName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, routeFilterName, expand)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Get", nil, "Failure preparing request")
return return
@ -232,7 +204,7 @@ func (client RouteFiltersClient) Get(resourceGroupName string, routeFilterName s
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client RouteFiltersClient) GetPreparer(resourceGroupName string, routeFilterName string, expand string) (*http.Request, error) { func (client RouteFiltersClient) GetPreparer(ctx context.Context, resourceGroupName string, routeFilterName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeFilterName": autorest.Encode("path", routeFilterName), "routeFilterName": autorest.Encode("path", routeFilterName),
@ -252,14 +224,13 @@ func (client RouteFiltersClient) GetPreparer(resourceGroupName string, routeFilt
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteFiltersClient) GetSender(req *http.Request) (*http.Response, error) { func (client RouteFiltersClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -277,8 +248,9 @@ func (client RouteFiltersClient) GetResponder(resp *http.Response) (result Route
} }
// List gets all route filters in a subscription. // List gets all route filters in a subscription.
func (client RouteFiltersClient) List() (result RouteFilterListResult, err error) { func (client RouteFiltersClient) List(ctx context.Context) (result RouteFilterListResultPage, err error) {
req, err := client.ListPreparer() result.fn = client.listNextResults
req, err := client.ListPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", nil, "Failure preparing request")
return return
@ -286,12 +258,12 @@ func (client RouteFiltersClient) List() (result RouteFilterListResult, err error
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.rflr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.rflr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure responding to request")
} }
@ -300,7 +272,7 @@ func (client RouteFiltersClient) List() (result RouteFilterListResult, err error
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client RouteFiltersClient) ListPreparer() (*http.Request, error) { func (client RouteFiltersClient) ListPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
} }
@ -315,14 +287,13 @@ func (client RouteFiltersClient) ListPreparer() (*http.Request, error) {
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeFilters", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteFiltersClient) ListSender(req *http.Request) (*http.Response, error) { func (client RouteFiltersClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -339,80 +310,39 @@ func (client RouteFiltersClient) ListResponder(resp *http.Response) (result Rout
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client RouteFiltersClient) ListNextResults(lastResults RouteFilterListResult) (result RouteFilterListResult, err error) { func (client RouteFiltersClient) listNextResults(lastResults RouteFilterListResult) (result RouteFilterListResult, err error) {
req, err := lastResults.RouteFilterListResultPreparer() req, err := lastResults.routeFilterListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client RouteFiltersClient) ListComplete(cancel <-chan struct{}) (<-chan RouteFilter, <-chan error) { func (client RouteFiltersClient) ListComplete(ctx context.Context) (result RouteFilterListResultIterator, err error) {
resultChan := make(chan RouteFilter) result.page, err = client.List(ctx)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
// ListByResourceGroup gets all route filters in a resource group. // ListByResourceGroup gets all route filters in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client RouteFiltersClient) ListByResourceGroup(resourceGroupName string) (result RouteFilterListResult, err error) { func (client RouteFiltersClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result RouteFilterListResultPage, err error) {
req, err := client.ListByResourceGroupPreparer(resourceGroupName) result.fn = client.listByResourceGroupNextResults
req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", nil, "Failure preparing request")
return return
@ -420,12 +350,12 @@ func (client RouteFiltersClient) ListByResourceGroup(resourceGroupName string) (
resp, err := client.ListByResourceGroupSender(req) resp, err := client.ListByResourceGroupSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.rflr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure sending request")
return return
} }
result, err = client.ListByResourceGroupResponder(resp) result.rflr, err = client.ListByResourceGroupResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure responding to request")
} }
@ -434,7 +364,7 @@ func (client RouteFiltersClient) ListByResourceGroup(resourceGroupName string) (
} }
// ListByResourceGroupPreparer prepares the ListByResourceGroup request. // ListByResourceGroupPreparer prepares the ListByResourceGroup request.
func (client RouteFiltersClient) ListByResourceGroupPreparer(resourceGroupName string) (*http.Request, error) { func (client RouteFiltersClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -450,14 +380,13 @@ func (client RouteFiltersClient) ListByResourceGroupPreparer(resourceGroupName s
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteFiltersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { func (client RouteFiltersClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -474,118 +403,55 @@ func (client RouteFiltersClient) ListByResourceGroupResponder(resp *http.Respons
return return
} }
// ListByResourceGroupNextResults retrieves the next set of results, if any. // listByResourceGroupNextResults retrieves the next set of results, if any.
func (client RouteFiltersClient) ListByResourceGroupNextResults(lastResults RouteFilterListResult) (result RouteFilterListResult, err error) { func (client RouteFiltersClient) listByResourceGroupNextResults(lastResults RouteFilterListResult) (result RouteFilterListResult, err error) {
req, err := lastResults.RouteFilterListResultPreparer() req, err := lastResults.routeFilterListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListByResourceGroupSender(req) resp, err := client.ListByResourceGroupSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.RouteFiltersClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListByResourceGroupResponder(resp) result, err = client.ListByResourceGroupResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "ListByResourceGroup", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
}
return
}
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
func (client RouteFiltersClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result RouteFilterListResultIterator, err error) {
result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
return
}
// Update updates a route filter in a specified resource group.
//
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter.
// routeFilterParameters is parameters supplied to the update route filter operation.
func (client RouteFiltersClient) Update(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters PatchRouteFilter) (result RouteFiltersUpdateFuture, err error) {
req, err := client.UpdatePreparer(ctx, resourceGroupName, routeFilterName, routeFilterParameters)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Update", nil, "Failure preparing request")
return
}
result, err = client.UpdateSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Update", result.Response(), "Failure sending request")
return
} }
return return
} }
// ListByResourceGroupComplete gets all elements from the list without paging.
func (client RouteFiltersClient) ListByResourceGroupComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan RouteFilter, <-chan error) {
resultChan := make(chan RouteFilter)
errChan := make(chan error, 1)
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListByResourceGroup(resourceGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListByResourceGroupNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
}
// Update updates a route filter in a specified resource group. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. routeFilterName is the name of the route filter.
// routeFilterParameters is parameters supplied to the update route filter operation.
func (client RouteFiltersClient) Update(resourceGroupName string, routeFilterName string, routeFilterParameters PatchRouteFilter, cancel <-chan struct{}) (<-chan RouteFilter, <-chan error) {
resultChan := make(chan RouteFilter, 1)
errChan := make(chan error, 1)
go func() {
var err error
var result RouteFilter
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.UpdatePreparer(resourceGroupName, routeFilterName, routeFilterParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Update", nil, "Failure preparing request")
return
}
resp, err := client.UpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Update", resp, "Failure sending request")
return
}
result, err = client.UpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteFiltersClient", "Update", resp, "Failure responding to request")
}
}()
return resultChan, errChan
}
// UpdatePreparer prepares the Update request. // UpdatePreparer prepares the Update request.
func (client RouteFiltersClient) UpdatePreparer(resourceGroupName string, routeFilterName string, routeFilterParameters PatchRouteFilter, cancel <-chan struct{}) (*http.Request, error) { func (client RouteFiltersClient) UpdatePreparer(ctx context.Context, resourceGroupName string, routeFilterName string, routeFilterParameters PatchRouteFilter) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeFilterName": autorest.Encode("path", routeFilterName), "routeFilterName": autorest.Encode("path", routeFilterName),
@ -604,16 +470,22 @@ func (client RouteFiltersClient) UpdatePreparer(resourceGroupName string, routeF
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeFilters/{routeFilterName}", pathParameters),
autorest.WithJSON(routeFilterParameters), autorest.WithJSON(routeFilterParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// UpdateSender sends the Update request. The method will close the // UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteFiltersClient) UpdateSender(req *http.Request) (*http.Response, error) { func (client RouteFiltersClient) UpdateSender(req *http.Request) (future RouteFiltersUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK))
return
} }
// UpdateResponder handles the response to the Update request. The method always // UpdateResponder handles the response to the Update request. The method always

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// RoutesClient is the network Client // RoutesClient is the network Client
type RoutesClient struct { type RoutesClient struct {
ManagementClient BaseClient
} }
// NewRoutesClient creates an instance of the RoutesClient client. // NewRoutesClient creates an instance of the RoutesClient client.
@ -38,49 +39,28 @@ func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesCli
return RoutesClient{NewWithBaseURI(baseURI, subscriptionID)} return RoutesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a route in the specified route table. This method may poll for completion. Polling // CreateOrUpdate creates or updates a route in the specified route table.
// can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is the // resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is the
// name of the route. routeParameters is parameters supplied to the create or update route operation. // name of the route. routeParameters is parameters supplied to the create or update route operation.
func (client RoutesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, routeName string, routeParameters Route, cancel <-chan struct{}) (<-chan Route, <-chan error) { func (client RoutesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters Route) (result RoutesCreateOrUpdateFuture, err error) {
resultChan := make(chan Route, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeTableName, routeName, routeParameters)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", nil, "Failure preparing request")
var err error return
var result Route }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, routeName, routeParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.RoutesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client RoutesClient) CreateOrUpdatePreparer(resourceGroupName string, routeTableName string, routeName string, routeParameters Route, cancel <-chan struct{}) (*http.Request, error) { func (client RoutesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, routeTableName string, routeName string, routeParameters Route) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeName": autorest.Encode("path", routeName), "routeName": autorest.Encode("path", routeName),
@ -100,16 +80,22 @@ func (client RoutesClient) CreateOrUpdatePreparer(resourceGroupName string, rout
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters),
autorest.WithJSON(routeParameters), autorest.WithJSON(routeParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RoutesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client RoutesClient) CreateOrUpdateSender(req *http.Request) (future RoutesCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -125,49 +111,28 @@ func (client RoutesClient) CreateOrUpdateResponder(resp *http.Response) (result
return return
} }
// Delete deletes the specified route from a route table. This method may poll for completion. Polling can be canceled // Delete deletes the specified route from a route table.
// by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
// //
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is the // resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is the
// name of the route. // name of the route.
func (client RoutesClient) Delete(resourceGroupName string, routeTableName string, routeName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client RoutesClient) Delete(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result RoutesDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, routeTableName, routeName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, routeTableName, routeName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.RoutesClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client RoutesClient) DeletePreparer(resourceGroupName string, routeTableName string, routeName string, cancel <-chan struct{}) (*http.Request, error) { func (client RoutesClient) DeletePreparer(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeName": autorest.Encode("path", routeName), "routeName": autorest.Encode("path", routeName),
@ -185,16 +150,22 @@ func (client RoutesClient) DeletePreparer(resourceGroupName string, routeTableNa
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RoutesClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client RoutesClient) DeleteSender(req *http.Request) (future RoutesDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -203,7 +174,7 @@ func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -213,8 +184,8 @@ func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest
// //
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is the // resourceGroupName is the name of the resource group. routeTableName is the name of the route table. routeName is the
// name of the route. // name of the route.
func (client RoutesClient) Get(resourceGroupName string, routeTableName string, routeName string) (result Route, err error) { func (client RoutesClient) Get(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (result Route, err error) {
req, err := client.GetPreparer(resourceGroupName, routeTableName, routeName) req, err := client.GetPreparer(ctx, resourceGroupName, routeTableName, routeName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RoutesClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.RoutesClient", "Get", nil, "Failure preparing request")
return return
@ -236,7 +207,7 @@ func (client RoutesClient) Get(resourceGroupName string, routeTableName string,
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client RoutesClient) GetPreparer(resourceGroupName string, routeTableName string, routeName string) (*http.Request, error) { func (client RoutesClient) GetPreparer(ctx context.Context, resourceGroupName string, routeTableName string, routeName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeName": autorest.Encode("path", routeName), "routeName": autorest.Encode("path", routeName),
@ -254,14 +225,13 @@ func (client RoutesClient) GetPreparer(resourceGroupName string, routeTableName
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RoutesClient) GetSender(req *http.Request) (*http.Response, error) { func (client RoutesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -281,8 +251,9 @@ func (client RoutesClient) GetResponder(resp *http.Response) (result Route, err
// List gets all routes in a route table. // List gets all routes in a route table.
// //
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. // resourceGroupName is the name of the resource group. routeTableName is the name of the route table.
func (client RoutesClient) List(resourceGroupName string, routeTableName string) (result RouteListResult, err error) { func (client RoutesClient) List(ctx context.Context, resourceGroupName string, routeTableName string) (result RouteListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, routeTableName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, routeTableName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", nil, "Failure preparing request")
return return
@ -290,12 +261,12 @@ func (client RoutesClient) List(resourceGroupName string, routeTableName string)
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.rlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.rlr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure responding to request")
} }
@ -304,7 +275,7 @@ func (client RoutesClient) List(resourceGroupName string, routeTableName string)
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client RoutesClient) ListPreparer(resourceGroupName string, routeTableName string) (*http.Request, error) { func (client RoutesClient) ListPreparer(ctx context.Context, resourceGroupName string, routeTableName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeTableName": autorest.Encode("path", routeTableName), "routeTableName": autorest.Encode("path", routeTableName),
@ -321,14 +292,13 @@ func (client RoutesClient) ListPreparer(resourceGroupName string, routeTableName
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RoutesClient) ListSender(req *http.Request) (*http.Response, error) { func (client RoutesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -345,71 +315,29 @@ func (client RoutesClient) ListResponder(resp *http.Response) (result RouteListR
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client RoutesClient) ListNextResults(lastResults RouteListResult) (result RouteListResult, err error) { func (client RoutesClient) listNextResults(lastResults RouteListResult) (result RouteListResult, err error) {
req, err := lastResults.RouteListResultPreparer() req, err := lastResults.routeListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.RoutesClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.RoutesClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.RoutesClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RoutesClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.RoutesClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client RoutesClient) ListComplete(resourceGroupName string, routeTableName string, cancel <-chan struct{}) (<-chan Route, <-chan error) { func (client RoutesClient) ListComplete(ctx context.Context, resourceGroupName string, routeTableName string) (result RouteListResultIterator, err error) {
resultChan := make(chan Route) result.page, err = client.List(ctx, resourceGroupName, routeTableName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, routeTableName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// RouteTablesClient is the network Client // RouteTablesClient is the network Client
type RouteTablesClient struct { type RouteTablesClient struct {
ManagementClient BaseClient
} }
// NewRouteTablesClient creates an instance of the RouteTablesClient client. // NewRouteTablesClient creates an instance of the RouteTablesClient client.
@ -38,49 +39,28 @@ func NewRouteTablesClientWithBaseURI(baseURI string, subscriptionID string) Rout
return RouteTablesClient{NewWithBaseURI(baseURI, subscriptionID)} return RouteTablesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate create or updates a route table in a specified resource group. This method may poll for completion. // CreateOrUpdate create or updates a route table in a specified resource group.
// Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. parameters is // resourceGroupName is the name of the resource group. routeTableName is the name of the route table. parameters is
// parameters supplied to the create or update route table operation. // parameters supplied to the create or update route table operation.
func (client RouteTablesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, parameters RouteTable, cancel <-chan struct{}) (<-chan RouteTable, <-chan error) { func (client RouteTablesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, routeTableName string, parameters RouteTable) (result RouteTablesCreateOrUpdateFuture, err error) {
resultChan := make(chan RouteTable, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, routeTableName, parameters)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", nil, "Failure preparing request")
var err error return
var result RouteTable }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client RouteTablesClient) CreateOrUpdatePreparer(resourceGroupName string, routeTableName string, parameters RouteTable, cancel <-chan struct{}) (*http.Request, error) { func (client RouteTablesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, routeTableName string, parameters RouteTable) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeTableName": autorest.Encode("path", routeTableName), "routeTableName": autorest.Encode("path", routeTableName),
@ -99,16 +79,22 @@ func (client RouteTablesClient) CreateOrUpdatePreparer(resourceGroupName string,
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters),
autorest.WithJSON(parameters), autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteTablesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client RouteTablesClient) CreateOrUpdateSender(req *http.Request) (future RouteTablesCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -124,47 +110,27 @@ func (client RouteTablesClient) CreateOrUpdateResponder(resp *http.Response) (re
return return
} }
// Delete deletes the specified route table. This method may poll for completion. Polling can be canceled by passing // Delete deletes the specified route table.
// the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. // resourceGroupName is the name of the resource group. routeTableName is the name of the route table.
func (client RouteTablesClient) Delete(resourceGroupName string, routeTableName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client RouteTablesClient) Delete(ctx context.Context, resourceGroupName string, routeTableName string) (result RouteTablesDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, routeTableName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, routeTableName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client RouteTablesClient) DeletePreparer(resourceGroupName string, routeTableName string, cancel <-chan struct{}) (*http.Request, error) { func (client RouteTablesClient) DeletePreparer(ctx context.Context, resourceGroupName string, routeTableName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeTableName": autorest.Encode("path", routeTableName), "routeTableName": autorest.Encode("path", routeTableName),
@ -181,16 +147,22 @@ func (client RouteTablesClient) DeletePreparer(resourceGroupName string, routeTa
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteTablesClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client RouteTablesClient) DeleteSender(req *http.Request) (future RouteTablesDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -199,7 +171,7 @@ func (client RouteTablesClient) DeleteResponder(resp *http.Response) (result aut
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK, http.StatusAccepted), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -209,8 +181,8 @@ func (client RouteTablesClient) DeleteResponder(resp *http.Response) (result aut
// //
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. expand is // resourceGroupName is the name of the resource group. routeTableName is the name of the route table. expand is
// expands referenced resources. // expands referenced resources.
func (client RouteTablesClient) Get(resourceGroupName string, routeTableName string, expand string) (result RouteTable, err error) { func (client RouteTablesClient) Get(ctx context.Context, resourceGroupName string, routeTableName string, expand string) (result RouteTable, err error) {
req, err := client.GetPreparer(resourceGroupName, routeTableName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, routeTableName, expand)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "Get", nil, "Failure preparing request")
return return
@ -232,7 +204,7 @@ func (client RouteTablesClient) Get(resourceGroupName string, routeTableName str
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client RouteTablesClient) GetPreparer(resourceGroupName string, routeTableName string, expand string) (*http.Request, error) { func (client RouteTablesClient) GetPreparer(ctx context.Context, resourceGroupName string, routeTableName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"routeTableName": autorest.Encode("path", routeTableName), "routeTableName": autorest.Encode("path", routeTableName),
@ -252,14 +224,13 @@ func (client RouteTablesClient) GetPreparer(resourceGroupName string, routeTable
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteTablesClient) GetSender(req *http.Request) (*http.Response, error) { func (client RouteTablesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -279,8 +250,9 @@ func (client RouteTablesClient) GetResponder(resp *http.Response) (result RouteT
// List gets all route tables in a resource group. // List gets all route tables in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client RouteTablesClient) List(resourceGroupName string) (result RouteTableListResult, err error) { func (client RouteTablesClient) List(ctx context.Context, resourceGroupName string) (result RouteTableListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", nil, "Failure preparing request")
return return
@ -288,12 +260,12 @@ func (client RouteTablesClient) List(resourceGroupName string) (result RouteTabl
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.rtlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.rtlr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure responding to request")
} }
@ -302,7 +274,7 @@ func (client RouteTablesClient) List(resourceGroupName string) (result RouteTabl
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client RouteTablesClient) ListPreparer(resourceGroupName string) (*http.Request, error) { func (client RouteTablesClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -318,14 +290,13 @@ func (client RouteTablesClient) ListPreparer(resourceGroupName string) (*http.Re
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteTablesClient) ListSender(req *http.Request) (*http.Response, error) { func (client RouteTablesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -342,78 +313,37 @@ func (client RouteTablesClient) ListResponder(resp *http.Response) (result Route
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client RouteTablesClient) ListNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) { func (client RouteTablesClient) listNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) {
req, err := lastResults.RouteTableListResultPreparer() req, err := lastResults.routeTableListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client RouteTablesClient) ListComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan RouteTable, <-chan error) { func (client RouteTablesClient) ListComplete(ctx context.Context, resourceGroupName string) (result RouteTableListResultIterator, err error) {
resultChan := make(chan RouteTable) result.page, err = client.List(ctx, resourceGroupName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
// ListAll gets all route tables in a subscription. // ListAll gets all route tables in a subscription.
func (client RouteTablesClient) ListAll() (result RouteTableListResult, err error) { func (client RouteTablesClient) ListAll(ctx context.Context) (result RouteTableListResultPage, err error) {
req, err := client.ListAllPreparer() result.fn = client.listAllNextResults
req, err := client.ListAllPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", nil, "Failure preparing request")
return return
@ -421,12 +351,12 @@ func (client RouteTablesClient) ListAll() (result RouteTableListResult, err erro
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.rtlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure sending request")
return return
} }
result, err = client.ListAllResponder(resp) result.rtlr, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure responding to request")
} }
@ -435,7 +365,7 @@ func (client RouteTablesClient) ListAll() (result RouteTableListResult, err erro
} }
// ListAllPreparer prepares the ListAll request. // ListAllPreparer prepares the ListAll request.
func (client RouteTablesClient) ListAllPreparer() (*http.Request, error) { func (client RouteTablesClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
} }
@ -450,14 +380,13 @@ func (client RouteTablesClient) ListAllPreparer() (*http.Request, error) {
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/routeTables", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListAllSender sends the ListAll request. The method will close the // ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client RouteTablesClient) ListAllSender(req *http.Request) (*http.Response, error) { func (client RouteTablesClient) ListAllSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -474,71 +403,100 @@ func (client RouteTablesClient) ListAllResponder(resp *http.Response) (result Ro
return return
} }
// ListAllNextResults retrieves the next set of results, if any. // listAllNextResults retrieves the next set of results, if any.
func (client RouteTablesClient) ListAllNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) { func (client RouteTablesClient) listAllNextResults(lastResults RouteTableListResult) (result RouteTableListResult, err error) {
req, err := lastResults.RouteTableListResultPreparer() req, err := lastResults.routeTableListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "listAllNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.RouteTablesClient", "listAllNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "ListAll", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "listAllNextResults", resp, "Failure responding to next results request")
}
return
}
// ListAllComplete enumerates all values, automatically crossing page boundaries as required.
func (client RouteTablesClient) ListAllComplete(ctx context.Context) (result RouteTableListResultIterator, err error) {
result.page, err = client.ListAll(ctx)
return
}
// UpdateTags updates a route table tags.
//
// resourceGroupName is the name of the resource group. routeTableName is the name of the route table. parameters is
// parameters supplied to update route table tags.
func (client RouteTablesClient) UpdateTags(ctx context.Context, resourceGroupName string, routeTableName string, parameters TagsObject) (result RouteTablesUpdateTagsFuture, err error) {
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, routeTableName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "UpdateTags", nil, "Failure preparing request")
return
}
result, err = client.UpdateTagsSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "network.RouteTablesClient", "UpdateTags", result.Response(), "Failure sending request")
return
} }
return return
} }
// ListAllComplete gets all elements from the list without paging. // UpdateTagsPreparer prepares the UpdateTags request.
func (client RouteTablesClient) ListAllComplete(cancel <-chan struct{}) (<-chan RouteTable, <-chan error) { func (client RouteTablesClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, routeTableName string, parameters TagsObject) (*http.Request, error) {
resultChan := make(chan RouteTable) pathParameters := map[string]interface{}{
errChan := make(chan error, 1) "resourceGroupName": autorest.Encode("path", resourceGroupName),
go func() { "routeTableName": autorest.Encode("path", routeTableName),
defer func() { "subscriptionId": autorest.Encode("path", client.SubscriptionID),
close(resultChan) }
close(errChan)
}() const APIVersion = "2017-09-01"
list, err := client.ListAll() queryParameters := map[string]interface{}{
if err != nil { "api-version": APIVersion,
errChan <- err }
return
} preparer := autorest.CreatePreparer(
if list.Value != nil { autorest.AsJSON(),
for _, item := range *list.Value { autorest.AsPatch(),
select { autorest.WithBaseURL(client.BaseURI),
case <-cancel: autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}", pathParameters),
return autorest.WithJSON(parameters),
case resultChan <- item: autorest.WithQueryParameters(queryParameters))
// Intentionally left blank return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
}
} // UpdateTagsSender sends the UpdateTags request. The method will close the
for list.NextLink != nil { // http.Response Body if it receives an error.
list, err = client.ListAllNextResults(list) func (client RouteTablesClient) UpdateTagsSender(req *http.Request) (future RouteTablesUpdateTagsFuture, err error) {
if err != nil { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
errChan <- err future.Future = azure.NewFuture(req)
return future.req = req
} _, err = future.Done(sender)
if list.Value != nil { if err != nil {
for _, item := range *list.Value { return
select { }
case <-cancel: err = autorest.Respond(future.Response(),
return azure.WithErrorUnlessStatusCode(http.StatusOK))
case resultChan <- item: return
// Intentionally left blank }
}
} // UpdateTagsResponder handles the response to the UpdateTags request. The method always
} // closes the http.Response Body.
} func (client RouteTablesClient) UpdateTagsResponder(resp *http.Response) (result RouteTable, err error) {
}() err = autorest.Respond(
return resultChan, errChan resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// SecurityGroupsClient is the network Client // SecurityGroupsClient is the network Client
type SecurityGroupsClient struct { type SecurityGroupsClient struct {
ManagementClient BaseClient
} }
// NewSecurityGroupsClient creates an instance of the SecurityGroupsClient client. // NewSecurityGroupsClient creates an instance of the SecurityGroupsClient client.
@ -38,49 +39,28 @@ func NewSecurityGroupsClientWithBaseURI(baseURI string, subscriptionID string) S
return SecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} return SecurityGroupsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a network security group in the specified resource group. This method may poll for // CreateOrUpdate creates or updates a network security group in the specified resource group.
// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security
// group. parameters is parameters supplied to the create or update network security group operation. // group. parameters is parameters supplied to the create or update network security group operation.
func (client SecurityGroupsClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, cancel <-chan struct{}) (<-chan SecurityGroup, <-chan error) { func (client SecurityGroupsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup) (result SecurityGroupsCreateOrUpdateFuture, err error) {
resultChan := make(chan SecurityGroup, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkSecurityGroupName, parameters)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request")
var err error return
var result SecurityGroup }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client SecurityGroupsClient) CreateOrUpdatePreparer(resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup, cancel <-chan struct{}) (*http.Request, error) { func (client SecurityGroupsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters SecurityGroup) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -99,16 +79,22 @@ func (client SecurityGroupsClient) CreateOrUpdatePreparer(resourceGroupName stri
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters),
autorest.WithJSON(parameters), autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client SecurityGroupsClient) CreateOrUpdateSender(req *http.Request) (future SecurityGroupsCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -117,55 +103,35 @@ func (client SecurityGroupsClient) CreateOrUpdateResponder(resp *http.Response)
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result), autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing()) autorest.ByClosing())
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return return
} }
// Delete deletes the specified network security group. This method may poll for completion. Polling can be canceled by // Delete deletes the specified network security group.
// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security
// group. // group.
func (client SecurityGroupsClient) Delete(resourceGroupName string, networkSecurityGroupName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client SecurityGroupsClient) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityGroupsDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, networkSecurityGroupName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, networkSecurityGroupName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client SecurityGroupsClient) DeletePreparer(resourceGroupName string, networkSecurityGroupName string, cancel <-chan struct{}) (*http.Request, error) { func (client SecurityGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -182,16 +148,22 @@ func (client SecurityGroupsClient) DeletePreparer(resourceGroupName string, netw
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SecurityGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client SecurityGroupsClient) DeleteSender(req *http.Request) (future SecurityGroupsDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -200,7 +172,7 @@ func (client SecurityGroupsClient) DeleteResponder(resp *http.Response) (result
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -210,8 +182,8 @@ func (client SecurityGroupsClient) DeleteResponder(resp *http.Response) (result
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security
// group. expand is expands referenced resources. // group. expand is expands referenced resources.
func (client SecurityGroupsClient) Get(resourceGroupName string, networkSecurityGroupName string, expand string) (result SecurityGroup, err error) { func (client SecurityGroupsClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, expand string) (result SecurityGroup, err error) {
req, err := client.GetPreparer(resourceGroupName, networkSecurityGroupName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, expand)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "Get", nil, "Failure preparing request")
return return
@ -233,7 +205,7 @@ func (client SecurityGroupsClient) Get(resourceGroupName string, networkSecurity
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client SecurityGroupsClient) GetPreparer(resourceGroupName string, networkSecurityGroupName string, expand string) (*http.Request, error) { func (client SecurityGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -253,14 +225,13 @@ func (client SecurityGroupsClient) GetPreparer(resourceGroupName string, network
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SecurityGroupsClient) GetSender(req *http.Request) (*http.Response, error) { func (client SecurityGroupsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -280,8 +251,9 @@ func (client SecurityGroupsClient) GetResponder(resp *http.Response) (result Sec
// List gets all network security groups in a resource group. // List gets all network security groups in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client SecurityGroupsClient) List(resourceGroupName string) (result SecurityGroupListResult, err error) { func (client SecurityGroupsClient) List(ctx context.Context, resourceGroupName string) (result SecurityGroupListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", nil, "Failure preparing request")
return return
@ -289,12 +261,12 @@ func (client SecurityGroupsClient) List(resourceGroupName string) (result Securi
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.sglr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.sglr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure responding to request")
} }
@ -303,7 +275,7 @@ func (client SecurityGroupsClient) List(resourceGroupName string) (result Securi
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client SecurityGroupsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { func (client SecurityGroupsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -319,14 +291,13 @@ func (client SecurityGroupsClient) ListPreparer(resourceGroupName string) (*http
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SecurityGroupsClient) ListSender(req *http.Request) (*http.Response, error) { func (client SecurityGroupsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -343,78 +314,37 @@ func (client SecurityGroupsClient) ListResponder(resp *http.Response) (result Se
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client SecurityGroupsClient) ListNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) { func (client SecurityGroupsClient) listNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) {
req, err := lastResults.SecurityGroupListResultPreparer() req, err := lastResults.securityGroupListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client SecurityGroupsClient) ListComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan SecurityGroup, <-chan error) { func (client SecurityGroupsClient) ListComplete(ctx context.Context, resourceGroupName string) (result SecurityGroupListResultIterator, err error) {
resultChan := make(chan SecurityGroup) result.page, err = client.List(ctx, resourceGroupName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
// ListAll gets all network security groups in a subscription. // ListAll gets all network security groups in a subscription.
func (client SecurityGroupsClient) ListAll() (result SecurityGroupListResult, err error) { func (client SecurityGroupsClient) ListAll(ctx context.Context) (result SecurityGroupListResultPage, err error) {
req, err := client.ListAllPreparer() result.fn = client.listAllNextResults
req, err := client.ListAllPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", nil, "Failure preparing request")
return return
@ -422,12 +352,12 @@ func (client SecurityGroupsClient) ListAll() (result SecurityGroupListResult, er
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.sglr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure sending request")
return return
} }
result, err = client.ListAllResponder(resp) result.sglr, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure responding to request")
} }
@ -436,7 +366,7 @@ func (client SecurityGroupsClient) ListAll() (result SecurityGroupListResult, er
} }
// ListAllPreparer prepares the ListAll request. // ListAllPreparer prepares the ListAll request.
func (client SecurityGroupsClient) ListAllPreparer() (*http.Request, error) { func (client SecurityGroupsClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
} }
@ -451,14 +381,13 @@ func (client SecurityGroupsClient) ListAllPreparer() (*http.Request, error) {
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkSecurityGroups", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListAllSender sends the ListAll request. The method will close the // ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SecurityGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) { func (client SecurityGroupsClient) ListAllSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -475,71 +404,100 @@ func (client SecurityGroupsClient) ListAllResponder(resp *http.Response) (result
return return
} }
// ListAllNextResults retrieves the next set of results, if any. // listAllNextResults retrieves the next set of results, if any.
func (client SecurityGroupsClient) ListAllNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) { func (client SecurityGroupsClient) listAllNextResults(lastResults SecurityGroupListResult) (result SecurityGroupListResult, err error) {
req, err := lastResults.SecurityGroupListResultPreparer() req, err := lastResults.securityGroupListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "listAllNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "listAllNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "ListAll", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "listAllNextResults", resp, "Failure responding to next results request")
}
return
}
// ListAllComplete enumerates all values, automatically crossing page boundaries as required.
func (client SecurityGroupsClient) ListAllComplete(ctx context.Context) (result SecurityGroupListResultIterator, err error) {
result.page, err = client.ListAll(ctx)
return
}
// UpdateTags updates a network security group tags.
//
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security
// group. parameters is parameters supplied to update network security group tags.
func (client SecurityGroupsClient) UpdateTags(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters TagsObject) (result SecurityGroupsUpdateTagsFuture, err error) {
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, networkSecurityGroupName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "UpdateTags", nil, "Failure preparing request")
return
}
result, err = client.UpdateTagsSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityGroupsClient", "UpdateTags", result.Response(), "Failure sending request")
return
} }
return return
} }
// ListAllComplete gets all elements from the list without paging. // UpdateTagsPreparer prepares the UpdateTags request.
func (client SecurityGroupsClient) ListAllComplete(cancel <-chan struct{}) (<-chan SecurityGroup, <-chan error) { func (client SecurityGroupsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, parameters TagsObject) (*http.Request, error) {
resultChan := make(chan SecurityGroup) pathParameters := map[string]interface{}{
errChan := make(chan error, 1) "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName),
go func() { "resourceGroupName": autorest.Encode("path", resourceGroupName),
defer func() { "subscriptionId": autorest.Encode("path", client.SubscriptionID),
close(resultChan) }
close(errChan)
}() const APIVersion = "2017-09-01"
list, err := client.ListAll() queryParameters := map[string]interface{}{
if err != nil { "api-version": APIVersion,
errChan <- err }
return
} preparer := autorest.CreatePreparer(
if list.Value != nil { autorest.AsJSON(),
for _, item := range *list.Value { autorest.AsPatch(),
select { autorest.WithBaseURL(client.BaseURI),
case <-cancel: autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}", pathParameters),
return autorest.WithJSON(parameters),
case resultChan <- item: autorest.WithQueryParameters(queryParameters))
// Intentionally left blank return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
}
} // UpdateTagsSender sends the UpdateTags request. The method will close the
for list.NextLink != nil { // http.Response Body if it receives an error.
list, err = client.ListAllNextResults(list) func (client SecurityGroupsClient) UpdateTagsSender(req *http.Request) (future SecurityGroupsUpdateTagsFuture, err error) {
if err != nil { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
errChan <- err future.Future = azure.NewFuture(req)
return future.req = req
} _, err = future.Done(sender)
if list.Value != nil { if err != nil {
for _, item := range *list.Value { return
select { }
case <-cancel: err = autorest.Respond(future.Response(),
return azure.WithErrorUnlessStatusCode(http.StatusOK))
case resultChan <- item: return
// Intentionally left blank }
}
} // UpdateTagsResponder handles the response to the UpdateTags request. The method always
} // closes the http.Response Body.
} func (client SecurityGroupsClient) UpdateTagsResponder(resp *http.Response) (result SecurityGroup, err error) {
}() err = autorest.Respond(
return resultChan, errChan resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
} }

View File

@ -18,15 +18,15 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http" "net/http"
) )
// SecurityRulesClient is the network Client // SecurityRulesClient is the network Client
type SecurityRulesClient struct { type SecurityRulesClient struct {
ManagementClient BaseClient
} }
// NewSecurityRulesClient creates an instance of the SecurityRulesClient client. // NewSecurityRulesClient creates an instance of the SecurityRulesClient client.
@ -39,62 +39,29 @@ func NewSecurityRulesClientWithBaseURI(baseURI string, subscriptionID string) Se
return SecurityRulesClient{NewWithBaseURI(baseURI, subscriptionID)} return SecurityRulesClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a security rule in the specified network security group. This method may poll for // CreateOrUpdate creates or updates a security rule in the specified network security group.
// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security
// group. securityRuleName is the name of the security rule. securityRuleParameters is parameters supplied to the // group. securityRuleName is the name of the security rule. securityRuleParameters is parameters supplied to the
// create or update network security rule operation. // create or update network security rule operation.
func (client SecurityRulesClient) CreateOrUpdate(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, cancel <-chan struct{}) (<-chan SecurityRule, <-chan error) { func (client SecurityRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule) (result SecurityRulesCreateOrUpdateFuture, err error) {
resultChan := make(chan SecurityRule, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters)
errChan := make(chan error, 1) if err != nil {
if err := validation.Validate([]validation.Validation{ err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", nil, "Failure preparing request")
{TargetValue: securityRuleParameters, return
Constraints: []validation.Constraint{{Target: "securityRuleParameters.SecurityRulePropertiesFormat", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "securityRuleParameters.SecurityRulePropertiesFormat.SourceAddressPrefix", Name: validation.Null, Rule: true, Chain: nil},
{Target: "securityRuleParameters.SecurityRulePropertiesFormat.DestinationAddressPrefix", Name: validation.Null, Rule: true, Chain: nil},
}}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "network.SecurityRulesClient", "CreateOrUpdate")
close(errChan)
close(resultChan)
return resultChan, errChan
} }
go func() { result, err = client.CreateOrUpdateSender(req)
var err error if err != nil {
var result SecurityRule err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", result.Response(), "Failure sending request")
defer func() { return
if err != nil { }
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkSecurityGroupName, securityRuleName, securityRuleParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) return
if err != nil {
result.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", resp, "Failure sending request")
return
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client SecurityRulesClient) CreateOrUpdatePreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule, cancel <-chan struct{}) (*http.Request, error) { func (client SecurityRulesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string, securityRuleParameters SecurityRule) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -114,16 +81,22 @@ func (client SecurityRulesClient) CreateOrUpdatePreparer(resourceGroupName strin
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters),
autorest.WithJSON(securityRuleParameters), autorest.WithJSON(securityRuleParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SecurityRulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client SecurityRulesClient) CreateOrUpdateSender(req *http.Request) (future SecurityRulesCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -139,48 +112,28 @@ func (client SecurityRulesClient) CreateOrUpdateResponder(resp *http.Response) (
return return
} }
// Delete deletes the specified network security rule. This method may poll for completion. Polling can be canceled by // Delete deletes the specified network security rule.
// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security
// group. securityRuleName is the name of the security rule. // group. securityRuleName is the name of the security rule.
func (client SecurityRulesClient) Delete(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client SecurityRulesClient) Delete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRulesDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, networkSecurityGroupName, securityRuleName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client SecurityRulesClient) DeletePreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string, cancel <-chan struct{}) (*http.Request, error) { func (client SecurityRulesClient) DeletePreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -198,16 +151,22 @@ func (client SecurityRulesClient) DeletePreparer(resourceGroupName string, netwo
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SecurityRulesClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client SecurityRulesClient) DeleteSender(req *http.Request) (future SecurityRulesDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -216,7 +175,7 @@ func (client SecurityRulesClient) DeleteResponder(resp *http.Response) (result a
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -226,8 +185,8 @@ func (client SecurityRulesClient) DeleteResponder(resp *http.Response) (result a
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security
// group. securityRuleName is the name of the security rule. // group. securityRuleName is the name of the security rule.
func (client SecurityRulesClient) Get(resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRule, err error) { func (client SecurityRulesClient) Get(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (result SecurityRule, err error) {
req, err := client.GetPreparer(resourceGroupName, networkSecurityGroupName, securityRuleName) req, err := client.GetPreparer(ctx, resourceGroupName, networkSecurityGroupName, securityRuleName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "Get", nil, "Failure preparing request")
return return
@ -249,7 +208,7 @@ func (client SecurityRulesClient) Get(resourceGroupName string, networkSecurityG
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client SecurityRulesClient) GetPreparer(resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (*http.Request, error) { func (client SecurityRulesClient) GetPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string, securityRuleName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -267,14 +226,13 @@ func (client SecurityRulesClient) GetPreparer(resourceGroupName string, networkS
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SecurityRulesClient) GetSender(req *http.Request) (*http.Response, error) { func (client SecurityRulesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -295,8 +253,9 @@ func (client SecurityRulesClient) GetResponder(resp *http.Response) (result Secu
// //
// resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security // resourceGroupName is the name of the resource group. networkSecurityGroupName is the name of the network security
// group. // group.
func (client SecurityRulesClient) List(resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResult, err error) { func (client SecurityRulesClient) List(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, networkSecurityGroupName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, networkSecurityGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", nil, "Failure preparing request")
return return
@ -304,12 +263,12 @@ func (client SecurityRulesClient) List(resourceGroupName string, networkSecurity
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.srlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.srlr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure responding to request")
} }
@ -318,7 +277,7 @@ func (client SecurityRulesClient) List(resourceGroupName string, networkSecurity
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client SecurityRulesClient) ListPreparer(resourceGroupName string, networkSecurityGroupName string) (*http.Request, error) { func (client SecurityRulesClient) ListPreparer(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName), "networkSecurityGroupName": autorest.Encode("path", networkSecurityGroupName),
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
@ -335,14 +294,13 @@ func (client SecurityRulesClient) ListPreparer(resourceGroupName string, network
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityGroups/{networkSecurityGroupName}/securityRules", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SecurityRulesClient) ListSender(req *http.Request) (*http.Response, error) { func (client SecurityRulesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -359,71 +317,29 @@ func (client SecurityRulesClient) ListResponder(resp *http.Response) (result Sec
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client SecurityRulesClient) ListNextResults(lastResults SecurityRuleListResult) (result SecurityRuleListResult, err error) { func (client SecurityRulesClient) listNextResults(lastResults SecurityRuleListResult) (result SecurityRuleListResult, err error) {
req, err := lastResults.SecurityRuleListResultPreparer() req, err := lastResults.securityRuleListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.SecurityRulesClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.SecurityRulesClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client SecurityRulesClient) ListComplete(resourceGroupName string, networkSecurityGroupName string, cancel <-chan struct{}) (<-chan SecurityRule, <-chan error) { func (client SecurityRulesClient) ListComplete(ctx context.Context, resourceGroupName string, networkSecurityGroupName string) (result SecurityRuleListResultIterator, err error) {
resultChan := make(chan SecurityRule) result.page, err = client.List(ctx, resourceGroupName, networkSecurityGroupName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, networkSecurityGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// SubnetsClient is the network Client // SubnetsClient is the network Client
type SubnetsClient struct { type SubnetsClient struct {
ManagementClient BaseClient
} }
// NewSubnetsClient creates an instance of the SubnetsClient client. // NewSubnetsClient creates an instance of the SubnetsClient client.
@ -38,50 +39,29 @@ func NewSubnetsClientWithBaseURI(baseURI string, subscriptionID string) SubnetsC
return SubnetsClient{NewWithBaseURI(baseURI, subscriptionID)} return SubnetsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a subnet in the specified virtual network. This method may poll for completion. // CreateOrUpdate creates or updates a subnet in the specified virtual network.
// Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
// subnetName is the name of the subnet. subnetParameters is parameters supplied to the create or update subnet // subnetName is the name of the subnet. subnetParameters is parameters supplied to the create or update subnet
// operation. // operation.
func (client SubnetsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, cancel <-chan struct{}) (<-chan Subnet, <-chan error) { func (client SubnetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet) (result SubnetsCreateOrUpdateFuture, err error) {
resultChan := make(chan Subnet, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, subnetName, subnetParameters)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", nil, "Failure preparing request")
var err error return
var result Subnet }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, subnetName, subnetParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client SubnetsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet, cancel <-chan struct{}) (*http.Request, error) { func (client SubnetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, subnetParameters Subnet) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subnetName": autorest.Encode("path", subnetName), "subnetName": autorest.Encode("path", subnetName),
@ -101,16 +81,22 @@ func (client SubnetsClient) CreateOrUpdatePreparer(resourceGroupName string, vir
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters),
autorest.WithJSON(subnetParameters), autorest.WithJSON(subnetParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SubnetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client SubnetsClient) CreateOrUpdateSender(req *http.Request) (future SubnetsCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -126,48 +112,28 @@ func (client SubnetsClient) CreateOrUpdateResponder(resp *http.Response) (result
return return
} }
// Delete deletes the specified subnet. This method may poll for completion. Polling can be canceled by passing the // Delete deletes the specified subnet.
// cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
// subnetName is the name of the subnet. // subnetName is the name of the subnet.
func (client SubnetsClient) Delete(resourceGroupName string, virtualNetworkName string, subnetName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client SubnetsClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (result SubnetsDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkName, subnetName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, subnetName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client SubnetsClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, subnetName string, cancel <-chan struct{}) (*http.Request, error) { func (client SubnetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subnetName": autorest.Encode("path", subnetName), "subnetName": autorest.Encode("path", subnetName),
@ -185,16 +151,22 @@ func (client SubnetsClient) DeletePreparer(resourceGroupName string, virtualNetw
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SubnetsClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client SubnetsClient) DeleteSender(req *http.Request) (future SubnetsDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -203,7 +175,7 @@ func (client SubnetsClient) DeleteResponder(resp *http.Response) (result autores
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -213,8 +185,8 @@ func (client SubnetsClient) DeleteResponder(resp *http.Response) (result autores
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
// subnetName is the name of the subnet. expand is expands referenced resources. // subnetName is the name of the subnet. expand is expands referenced resources.
func (client SubnetsClient) Get(resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result Subnet, err error) { func (client SubnetsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (result Subnet, err error) {
req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, subnetName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, subnetName, expand)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.SubnetsClient", "Get", nil, "Failure preparing request")
return return
@ -236,7 +208,7 @@ func (client SubnetsClient) Get(resourceGroupName string, virtualNetworkName str
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client SubnetsClient) GetPreparer(resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (*http.Request, error) { func (client SubnetsClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, subnetName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subnetName": autorest.Encode("path", subnetName), "subnetName": autorest.Encode("path", subnetName),
@ -257,14 +229,13 @@ func (client SubnetsClient) GetPreparer(resourceGroupName string, virtualNetwork
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SubnetsClient) GetSender(req *http.Request) (*http.Response, error) { func (client SubnetsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -284,8 +255,9 @@ func (client SubnetsClient) GetResponder(resp *http.Response) (result Subnet, er
// List gets all subnets in a virtual network. // List gets all subnets in a virtual network.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
func (client SubnetsClient) List(resourceGroupName string, virtualNetworkName string) (result SubnetListResult, err error) { func (client SubnetsClient) List(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result SubnetListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, virtualNetworkName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, virtualNetworkName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", nil, "Failure preparing request")
return return
@ -293,12 +265,12 @@ func (client SubnetsClient) List(resourceGroupName string, virtualNetworkName st
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.slr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.slr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure responding to request")
} }
@ -307,7 +279,7 @@ func (client SubnetsClient) List(resourceGroupName string, virtualNetworkName st
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client SubnetsClient) ListPreparer(resourceGroupName string, virtualNetworkName string) (*http.Request, error) { func (client SubnetsClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -324,14 +296,13 @@ func (client SubnetsClient) ListPreparer(resourceGroupName string, virtualNetwor
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client SubnetsClient) ListSender(req *http.Request) (*http.Response, error) { func (client SubnetsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -348,71 +319,29 @@ func (client SubnetsClient) ListResponder(resp *http.Response) (result SubnetLis
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client SubnetsClient) ListNextResults(lastResults SubnetListResult) (result SubnetListResult, err error) { func (client SubnetsClient) listNextResults(lastResults SubnetListResult) (result SubnetListResult, err error) {
req, err := lastResults.SubnetListResultPreparer() req, err := lastResults.subnetListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.SubnetsClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.SubnetsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.SubnetsClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client SubnetsClient) ListComplete(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (<-chan Subnet, <-chan error) { func (client SubnetsClient) ListComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result SubnetListResultIterator, err error) {
resultChan := make(chan Subnet) result.page, err = client.List(ctx, resourceGroupName, virtualNetworkName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, virtualNetworkName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/autorest/validation"
@ -26,7 +27,7 @@ import (
// UsagesClient is the network Client // UsagesClient is the network Client
type UsagesClient struct { type UsagesClient struct {
ManagementClient BaseClient
} }
// NewUsagesClient creates an instance of the UsagesClient client. // NewUsagesClient creates an instance of the UsagesClient client.
@ -42,14 +43,15 @@ func NewUsagesClientWithBaseURI(baseURI string, subscriptionID string) UsagesCli
// List list network usages for a subscription. // List list network usages for a subscription.
// //
// location is the location where resource usage is queried. // location is the location where resource usage is queried.
func (client UsagesClient) List(location string) (result UsagesListResult, err error) { func (client UsagesClient) List(ctx context.Context, location string) (result UsagesListResultPage, err error) {
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: location, {TargetValue: location,
Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "location", Name: validation.Pattern, Rule: `^[-\w\._ ]+$`, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "network.UsagesClient", "List") return result, validation.NewErrorWithValidationError(err, "network.UsagesClient", "List")
} }
req, err := client.ListPreparer(location) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, location)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", nil, "Failure preparing request")
return return
@ -57,12 +59,12 @@ func (client UsagesClient) List(location string) (result UsagesListResult, err e
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.ulr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.ulr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure responding to request")
} }
@ -71,7 +73,7 @@ func (client UsagesClient) List(location string) (result UsagesListResult, err e
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client UsagesClient) ListPreparer(location string) (*http.Request, error) { func (client UsagesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"location": autorest.Encode("path", location), "location": autorest.Encode("path", location),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -87,14 +89,13 @@ func (client UsagesClient) ListPreparer(location string) (*http.Request, error)
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/usages", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) { func (client UsagesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -111,71 +112,29 @@ func (client UsagesClient) ListResponder(resp *http.Response) (result UsagesList
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client UsagesClient) ListNextResults(lastResults UsagesListResult) (result UsagesListResult, err error) { func (client UsagesClient) listNextResults(lastResults UsagesListResult) (result UsagesListResult, err error) {
req, err := lastResults.UsagesListResultPreparer() req, err := lastResults.usagesListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.UsagesClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.UsagesClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.UsagesClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.UsagesClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.UsagesClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client UsagesClient) ListComplete(location string, cancel <-chan struct{}) (<-chan Usage, <-chan error) { func (client UsagesClient) ListComplete(ctx context.Context, location string) (result UsagesListResultIterator, err error) {
resultChan := make(chan Usage) result.page, err = client.List(ctx, location)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(location)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -19,7 +19,7 @@ package network
// UserAgent returns the UserAgent string to use when sending http.Requests. // UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string { func UserAgent() string {
return "Azure-SDK-For-Go/v12.4.0-beta arm-network/" return "Azure-SDK-For-Go/v12.4.0-beta services"
} }
// Version returns the semantic version (see http://semver.org) of the client. // Version returns the semantic version (see http://semver.org) of the client.

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation" "github.com/Azure/go-autorest/autorest/validation"
@ -26,7 +27,7 @@ import (
// VirtualNetworkGatewayConnectionsClient is the network Client // VirtualNetworkGatewayConnectionsClient is the network Client
type VirtualNetworkGatewayConnectionsClient struct { type VirtualNetworkGatewayConnectionsClient struct {
ManagementClient BaseClient
} }
// NewVirtualNetworkGatewayConnectionsClient creates an instance of the VirtualNetworkGatewayConnectionsClient client. // NewVirtualNetworkGatewayConnectionsClient creates an instance of the VirtualNetworkGatewayConnectionsClient client.
@ -40,16 +41,12 @@ func NewVirtualNetworkGatewayConnectionsClientWithBaseURI(baseURI string, subscr
return VirtualNetworkGatewayConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} return VirtualNetworkGatewayConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a virtual network gateway connection in the specified resource group. This method // CreateOrUpdate creates or updates a virtual network gateway connection in the specified resource group.
// may poll for completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to
// cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the virtual // resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the virtual
// network gateway connection. parameters is parameters supplied to the create or update virtual network gateway // network gateway connection. parameters is parameters supplied to the create or update virtual network gateway
// connection operation. // connection operation.
func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, cancel <-chan struct{}) (<-chan VirtualNetworkGatewayConnection, <-chan error) { func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection) (result VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) {
resultChan := make(chan VirtualNetworkGatewayConnection, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat", Name: validation.Null, Rule: true, Constraints: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat", Name: validation.Null, Rule: true,
@ -60,46 +57,26 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdate(resourceGrou
{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2", Name: validation.Null, Rule: false, {Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2", Name: validation.Null, Rule: false,
Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}}, Chain: []validation.Constraint{{Target: "parameters.VirtualNetworkGatewayConnectionPropertiesFormat.LocalNetworkGateway2.LocalNetworkGatewayPropertiesFormat", Name: validation.Null, Rule: true, Chain: nil}}},
}}}}}); err != nil { }}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate") return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate")
close(errChan)
close(resultChan)
return resultChan, errChan
} }
go func() { req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
var err error if err != nil {
var result VirtualNetworkGatewayConnection err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request")
defer func() { return
if err != nil { }
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection, cancel <-chan struct{}) (*http.Request, error) { func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters VirtualNetworkGatewayConnection) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -118,16 +95,22 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdatePreparer(reso
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters),
autorest.WithJSON(parameters), autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkGatewayConnectionsCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -143,49 +126,28 @@ func (client VirtualNetworkGatewayConnectionsClient) CreateOrUpdateResponder(res
return return
} }
// Delete deletes the specified virtual network Gateway connection. This method may poll for completion. Polling can be // Delete deletes the specified virtual network Gateway connection.
// canceled by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the virtual // resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the virtual
// network gateway connection. // network gateway connection.
func (client VirtualNetworkGatewayConnectionsClient) Delete(resourceGroupName string, virtualNetworkGatewayConnectionName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client VirtualNetworkGatewayConnectionsClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnectionsDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkGatewayConnectionName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, cancel <-chan struct{}) (*http.Request, error) { func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -202,16 +164,22 @@ func (client VirtualNetworkGatewayConnectionsClient) DeletePreparer(resourceGrou
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworkGatewayConnectionsClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworkGatewayConnectionsClient) DeleteSender(req *http.Request) (future VirtualNetworkGatewayConnectionsDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -230,8 +198,8 @@ func (client VirtualNetworkGatewayConnectionsClient) DeleteResponder(resp *http.
// //
// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the virtual // resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the virtual
// network gateway connection. // network gateway connection.
func (client VirtualNetworkGatewayConnectionsClient) Get(resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnection, err error) { func (client VirtualNetworkGatewayConnectionsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result VirtualNetworkGatewayConnection, err error) {
req, err := client.GetPreparer(resourceGroupName, virtualNetworkGatewayConnectionName) req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "Get", nil, "Failure preparing request")
return return
@ -253,7 +221,7 @@ func (client VirtualNetworkGatewayConnectionsClient) Get(resourceGroupName strin
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client VirtualNetworkGatewayConnectionsClient) GetPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { func (client VirtualNetworkGatewayConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -270,14 +238,13 @@ func (client VirtualNetworkGatewayConnectionsClient) GetPreparer(resourceGroupNa
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworkGatewayConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworkGatewayConnectionsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -299,8 +266,8 @@ func (client VirtualNetworkGatewayConnectionsClient) GetResponder(resp *http.Res
// //
// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the virtual network // resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the virtual network
// gateway connection shared key name. // gateway connection shared key name.
func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string) (result ConnectionSharedKey, err error) { func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (result ConnectionSharedKey, err error) {
req, err := client.GetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName) req, err := client.GetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "GetSharedKey", nil, "Failure preparing request")
return return
@ -322,7 +289,7 @@ func (client VirtualNetworkGatewayConnectionsClient) GetSharedKey(resourceGroupN
} }
// GetSharedKeyPreparer prepares the GetSharedKey request. // GetSharedKeyPreparer prepares the GetSharedKey request.
func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) { func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -339,14 +306,13 @@ func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyPreparer(resour
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSharedKeySender sends the GetSharedKey request. The method will close the // GetSharedKeySender sends the GetSharedKey request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeySender(req *http.Request) (*http.Response, error) { func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -367,8 +333,9 @@ func (client VirtualNetworkGatewayConnectionsClient) GetSharedKeyResponder(resp
// created. // created.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client VirtualNetworkGatewayConnectionsClient) List(resourceGroupName string) (result VirtualNetworkGatewayConnectionListResult, err error) { func (client VirtualNetworkGatewayConnectionsClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayConnectionListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing request")
return return
@ -376,12 +343,12 @@ func (client VirtualNetworkGatewayConnectionsClient) List(resourceGroupName stri
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.vngclr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.vngclr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to request")
} }
@ -390,7 +357,7 @@ func (client VirtualNetworkGatewayConnectionsClient) List(resourceGroupName stri
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client VirtualNetworkGatewayConnectionsClient) ListPreparer(resourceGroupName string) (*http.Request, error) { func (client VirtualNetworkGatewayConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -406,14 +373,13 @@ func (client VirtualNetworkGatewayConnectionsClient) ListPreparer(resourceGroupN
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworkGatewayConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworkGatewayConnectionsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -430,132 +396,67 @@ func (client VirtualNetworkGatewayConnectionsClient) ListResponder(resp *http.Re
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client VirtualNetworkGatewayConnectionsClient) ListNextResults(lastResults VirtualNetworkGatewayConnectionListResult) (result VirtualNetworkGatewayConnectionListResult, err error) { func (client VirtualNetworkGatewayConnectionsClient) listNextResults(lastResults VirtualNetworkGatewayConnectionListResult) (result VirtualNetworkGatewayConnectionListResult, err error) {
req, err := lastResults.VirtualNetworkGatewayConnectionListResultPreparer() req, err := lastResults.virtualNetworkGatewayConnectionListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client VirtualNetworkGatewayConnectionsClient) ListComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan VirtualNetworkGatewayConnection, <-chan error) { func (client VirtualNetworkGatewayConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkGatewayConnectionListResultIterator, err error) {
resultChan := make(chan VirtualNetworkGatewayConnection) result.page, err = client.List(ctx, resourceGroupName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
// ResetSharedKey the VirtualNetworkGatewayConnectionResetSharedKey operation resets the virtual network gateway // 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 // connection shared key for passed virtual network gateway connection in the specified resource group through Network
// resource provider. This method may poll for completion. Polling can be canceled by passing the cancel channel // resource provider.
// argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the virtual network // resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the virtual network
// gateway connection reset shared key Name. parameters is parameters supplied to the begin reset virtual network // gateway connection reset shared key Name. parameters is parameters supplied to the begin reset virtual network
// gateway connection shared key operation through network resource provider. // gateway connection shared key operation through network resource provider.
func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, cancel <-chan struct{}) (<-chan ConnectionResetSharedKey, <-chan error) { func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey) (result VirtualNetworkGatewayConnectionsResetSharedKeyFuture, err error) {
resultChan := make(chan ConnectionResetSharedKey, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.Null, Rule: true, Constraints: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.InclusiveMaximum, Rule: 128, Chain: nil}, Chain: []validation.Constraint{{Target: "parameters.KeyLength", Name: validation.InclusiveMaximum, Rule: 128, Chain: nil},
{Target: "parameters.KeyLength", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil}, {Target: "parameters.KeyLength", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil},
}}}}}); err != nil { }}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey") return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey")
close(errChan)
close(resultChan)
return resultChan, errChan
} }
go func() { req, err := client.ResetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
var err error if err != nil {
var result ConnectionResetSharedKey err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", nil, "Failure preparing request")
defer func() { return
if err != nil { }
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.ResetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", nil, "Failure preparing request")
return
}
resp, err := client.ResetSharedKeySender(req) result, err = client.ResetSharedKeySender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", resp, "Failure sending request") return
return }
}
result, err = client.ResetSharedKeyResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "ResetSharedKey", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// ResetSharedKeyPreparer prepares the ResetSharedKey request. // ResetSharedKeyPreparer prepares the ResetSharedKey request.
func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey, cancel <-chan struct{}) (*http.Request, error) { func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionResetSharedKey) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -574,16 +475,22 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyPreparer(reso
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey/reset", pathParameters),
autorest.WithJSON(parameters), autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ResetSharedKeySender sends the ResetSharedKey request. The method will close the // ResetSharedKeySender sends the ResetSharedKey request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeySender(req *http.Request) (*http.Response, error) { func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeySender(req *http.Request) (future VirtualNetworkGatewayConnectionsResetSharedKeyFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted))
return
} }
// ResetSharedKeyResponder handles the response to the ResetSharedKey request. The method always // ResetSharedKeyResponder handles the response to the ResetSharedKey request. The method always
@ -601,58 +508,35 @@ func (client VirtualNetworkGatewayConnectionsClient) ResetSharedKeyResponder(res
// SetSharedKey the Put VirtualNetworkGatewayConnectionSharedKey operation sets the virtual network gateway connection // 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 // shared key for passed virtual network gateway connection in the specified resource group through Network resource
// provider. This method may poll for completion. Polling can be canceled by passing the cancel channel argument. The // provider.
// channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the virtual network // resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the virtual network
// gateway connection name. parameters is parameters supplied to the Begin Set Virtual Network Gateway connection // gateway connection name. parameters is parameters supplied to the Begin Set Virtual Network Gateway connection
// Shared key operation throughNetwork resource provider. // Shared key operation throughNetwork resource provider.
func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, cancel <-chan struct{}) (<-chan ConnectionSharedKey, <-chan error) { func (client VirtualNetworkGatewayConnectionsClient) SetSharedKey(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey) (result VirtualNetworkGatewayConnectionsSetSharedKeyFuture, err error) {
resultChan := make(chan ConnectionSharedKey, 1)
errChan := make(chan error, 1)
if err := validation.Validate([]validation.Validation{ if err := validation.Validate([]validation.Validation{
{TargetValue: parameters, {TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { Constraints: []validation.Constraint{{Target: "parameters.Value", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
errChan <- validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey") return result, validation.NewErrorWithValidationError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey")
close(errChan)
close(resultChan)
return resultChan, errChan
} }
go func() { req, err := client.SetSharedKeyPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
var err error if err != nil {
var result ConnectionSharedKey err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", nil, "Failure preparing request")
defer func() { return
if err != nil { }
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.SetSharedKeyPreparer(resourceGroupName, virtualNetworkGatewayConnectionName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", nil, "Failure preparing request")
return
}
resp, err := client.SetSharedKeySender(req) result, err = client.SetSharedKeySender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", resp, "Failure sending request") return
return }
}
result, err = client.SetSharedKeyResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "SetSharedKey", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// SetSharedKeyPreparer prepares the SetSharedKey request. // SetSharedKeyPreparer prepares the SetSharedKey request.
func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey, cancel <-chan struct{}) (*http.Request, error) { func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters ConnectionSharedKey) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -671,16 +555,22 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyPreparer(resour
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}/sharedkey", pathParameters),
autorest.WithJSON(parameters), autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// SetSharedKeySender sends the SetSharedKey request. The method will close the // SetSharedKeySender sends the SetSharedKey request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeySender(req *http.Request) (*http.Response, error) { func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeySender(req *http.Request) (future VirtualNetworkGatewayConnectionsSetSharedKeyFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// SetSharedKeyResponder handles the response to the SetSharedKey request. The method always // SetSharedKeyResponder handles the response to the SetSharedKey request. The method always
@ -689,7 +579,78 @@ func (client VirtualNetworkGatewayConnectionsClient) SetSharedKeyResponder(resp
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// UpdateTags updates a virtual network gateway connection tags.
//
// resourceGroupName is the name of the resource group. virtualNetworkGatewayConnectionName is the name of the virtual
// network gateway connection. parameters is parameters supplied to update virtual network gateway connection tags.
func (client VirtualNetworkGatewayConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject) (result VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) {
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkGatewayConnectionName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "UpdateTags", nil, "Failure preparing request")
return
}
result, err = client.UpdateTagsSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkGatewayConnectionsClient", "UpdateTags", result.Response(), "Failure sending request")
return
}
return
}
// UpdateTagsPreparer prepares the UpdateTags request.
func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkGatewayConnectionName string, parameters TagsObject) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"virtualNetworkGatewayConnectionName": autorest.Encode("path", virtualNetworkGatewayConnectionName),
}
const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/connections/{virtualNetworkGatewayConnectionName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// UpdateTagsSender sends the UpdateTags request. The method will close the
// http.Response Body if it receives an error.
func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsSender(req *http.Request) (future VirtualNetworkGatewayConnectionsUpdateTagsFuture, err error) {
sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
future.Future = azure.NewFuture(req)
future.req = req
_, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK))
return
}
// UpdateTagsResponder handles the response to the UpdateTags request. The method always
// closes the http.Response Body.
func (client VirtualNetworkGatewayConnectionsClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetworkGatewayConnectionListEntity, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result), autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing()) autorest.ByClosing())
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// VirtualNetworkPeeringsClient is the network Client // VirtualNetworkPeeringsClient is the network Client
type VirtualNetworkPeeringsClient struct { type VirtualNetworkPeeringsClient struct {
ManagementClient BaseClient
} }
// NewVirtualNetworkPeeringsClient creates an instance of the VirtualNetworkPeeringsClient client. // NewVirtualNetworkPeeringsClient creates an instance of the VirtualNetworkPeeringsClient client.
@ -38,50 +39,29 @@ func NewVirtualNetworkPeeringsClientWithBaseURI(baseURI string, subscriptionID s
return VirtualNetworkPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)} return VirtualNetworkPeeringsClient{NewWithBaseURI(baseURI, subscriptionID)}
} }
// CreateOrUpdate creates or updates a peering in the specified virtual network. This method may poll for completion. // CreateOrUpdate creates or updates a peering in the specified virtual network.
// Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
// virtualNetworkPeeringName is the name of the peering. virtualNetworkPeeringParameters is parameters supplied to the // virtualNetworkPeeringName is the name of the peering. virtualNetworkPeeringParameters is parameters supplied to the
// create or update virtual network peering operation. // create or update virtual network peering operation.
func (client VirtualNetworkPeeringsClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, cancel <-chan struct{}) (<-chan VirtualNetworkPeering, <-chan error) { func (client VirtualNetworkPeeringsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering) (result VirtualNetworkPeeringsCreateOrUpdateFuture, err error) {
resultChan := make(chan VirtualNetworkPeering, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request")
var err error return
var result VirtualNetworkPeering }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, virtualNetworkPeeringParameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client VirtualNetworkPeeringsClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering, cancel <-chan struct{}) (*http.Request, error) { func (client VirtualNetworkPeeringsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, virtualNetworkPeeringParameters VirtualNetworkPeering) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -101,16 +81,22 @@ func (client VirtualNetworkPeeringsClient) CreateOrUpdatePreparer(resourceGroupN
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters),
autorest.WithJSON(virtualNetworkPeeringParameters), autorest.WithJSON(virtualNetworkPeeringParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworkPeeringsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworkPeeringsClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworkPeeringsCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -126,49 +112,28 @@ func (client VirtualNetworkPeeringsClient) CreateOrUpdateResponder(resp *http.Re
return return
} }
// Delete deletes the specified virtual network peering. This method may poll for completion. Polling can be canceled // Delete deletes the specified virtual network peering.
// by passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP
// requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
// virtualNetworkPeeringName is the name of the virtual network peering. // virtualNetworkPeeringName is the name of the virtual network peering.
func (client VirtualNetworkPeeringsClient) Delete(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client VirtualNetworkPeeringsClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result VirtualNetworkPeeringsDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client VirtualNetworkPeeringsClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string, cancel <-chan struct{}) (*http.Request, error) { func (client VirtualNetworkPeeringsClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -186,16 +151,22 @@ func (client VirtualNetworkPeeringsClient) DeletePreparer(resourceGroupName stri
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworkPeeringsClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworkPeeringsClient) DeleteSender(req *http.Request) (future VirtualNetworkPeeringsDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -204,7 +175,7 @@ func (client VirtualNetworkPeeringsClient) DeleteResponder(resp *http.Response)
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -214,8 +185,8 @@ func (client VirtualNetworkPeeringsClient) DeleteResponder(resp *http.Response)
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
// virtualNetworkPeeringName is the name of the virtual network peering. // virtualNetworkPeeringName is the name of the virtual network peering.
func (client VirtualNetworkPeeringsClient) Get(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result VirtualNetworkPeering, err error) { func (client VirtualNetworkPeeringsClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (result VirtualNetworkPeering, err error) {
req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, virtualNetworkPeeringName) req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, virtualNetworkPeeringName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "Get", nil, "Failure preparing request")
return return
@ -237,7 +208,7 @@ func (client VirtualNetworkPeeringsClient) Get(resourceGroupName string, virtual
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client VirtualNetworkPeeringsClient) GetPreparer(resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (*http.Request, error) { func (client VirtualNetworkPeeringsClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, virtualNetworkPeeringName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -255,14 +226,13 @@ func (client VirtualNetworkPeeringsClient) GetPreparer(resourceGroupName string,
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings/{virtualNetworkPeeringName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworkPeeringsClient) GetSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworkPeeringsClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -282,8 +252,9 @@ func (client VirtualNetworkPeeringsClient) GetResponder(resp *http.Response) (re
// List gets all virtual network peerings in a virtual network. // List gets all virtual network peerings in a virtual network.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
func (client VirtualNetworkPeeringsClient) List(resourceGroupName string, virtualNetworkName string) (result VirtualNetworkPeeringListResult, err error) { func (client VirtualNetworkPeeringsClient) List(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkPeeringListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName, virtualNetworkName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName, virtualNetworkName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", nil, "Failure preparing request")
return return
@ -291,12 +262,12 @@ func (client VirtualNetworkPeeringsClient) List(resourceGroupName string, virtua
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.vnplr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.vnplr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure responding to request")
} }
@ -305,7 +276,7 @@ func (client VirtualNetworkPeeringsClient) List(resourceGroupName string, virtua
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client VirtualNetworkPeeringsClient) ListPreparer(resourceGroupName string, virtualNetworkName string) (*http.Request, error) { func (client VirtualNetworkPeeringsClient) ListPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -322,14 +293,13 @@ func (client VirtualNetworkPeeringsClient) ListPreparer(resourceGroupName string
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/virtualNetworkPeerings", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworkPeeringsClient) ListSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworkPeeringsClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -346,71 +316,29 @@ func (client VirtualNetworkPeeringsClient) ListResponder(resp *http.Response) (r
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client VirtualNetworkPeeringsClient) ListNextResults(lastResults VirtualNetworkPeeringListResult) (result VirtualNetworkPeeringListResult, err error) { func (client VirtualNetworkPeeringsClient) listNextResults(lastResults VirtualNetworkPeeringListResult) (result VirtualNetworkPeeringListResult, err error) {
req, err := lastResults.VirtualNetworkPeeringListResultPreparer() req, err := lastResults.virtualNetworkPeeringListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.VirtualNetworkPeeringsClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client VirtualNetworkPeeringsClient) ListComplete(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (<-chan VirtualNetworkPeering, <-chan error) { func (client VirtualNetworkPeeringsClient) ListComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkPeeringListResultIterator, err error) {
resultChan := make(chan VirtualNetworkPeering) result.page, err = client.List(ctx, resourceGroupName, virtualNetworkName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName, virtualNetworkName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }

View File

@ -18,6 +18,7 @@ package network
// Changes may cause incorrect behavior and will be lost if the code is regenerated. // Changes may cause incorrect behavior and will be lost if the code is regenerated.
import ( import (
"context"
"github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/azure"
"net/http" "net/http"
@ -25,7 +26,7 @@ import (
// VirtualNetworksClient is the network Client // VirtualNetworksClient is the network Client
type VirtualNetworksClient struct { type VirtualNetworksClient struct {
ManagementClient BaseClient
} }
// NewVirtualNetworksClient creates an instance of the VirtualNetworksClient client. // NewVirtualNetworksClient creates an instance of the VirtualNetworksClient client.
@ -42,8 +43,8 @@ func NewVirtualNetworksClientWithBaseURI(baseURI string, subscriptionID string)
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
// IPAddress is the private IP address to be verified. // IPAddress is the private IP address to be verified.
func (client VirtualNetworksClient) CheckIPAddressAvailability(resourceGroupName string, virtualNetworkName string, IPAddress string) (result IPAddressAvailabilityResult, err error) { func (client VirtualNetworksClient) CheckIPAddressAvailability(ctx context.Context, resourceGroupName string, virtualNetworkName string, IPAddress string) (result IPAddressAvailabilityResult, err error) {
req, err := client.CheckIPAddressAvailabilityPreparer(resourceGroupName, virtualNetworkName, IPAddress) req, err := client.CheckIPAddressAvailabilityPreparer(ctx, resourceGroupName, virtualNetworkName, IPAddress)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CheckIPAddressAvailability", nil, "Failure preparing request")
return return
@ -65,7 +66,7 @@ func (client VirtualNetworksClient) CheckIPAddressAvailability(resourceGroupName
} }
// CheckIPAddressAvailabilityPreparer prepares the CheckIPAddressAvailability request. // CheckIPAddressAvailabilityPreparer prepares the CheckIPAddressAvailability request.
func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(resourceGroupName string, virtualNetworkName string, IPAddress string) (*http.Request, error) { func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, IPAddress string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -85,14 +86,13 @@ func (client VirtualNetworksClient) CheckIPAddressAvailabilityPreparer(resourceG
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/CheckIPAddressAvailability", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CheckIPAddressAvailabilitySender sends the CheckIPAddressAvailability request. The method will close the // CheckIPAddressAvailabilitySender sends the CheckIPAddressAvailability request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworksClient) CheckIPAddressAvailabilitySender(req *http.Request) (*http.Response, error) { func (client VirtualNetworksClient) CheckIPAddressAvailabilitySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -109,49 +109,28 @@ func (client VirtualNetworksClient) CheckIPAddressAvailabilityResponder(resp *ht
return return
} }
// CreateOrUpdate creates or updates a virtual network in the specified resource group. This method may poll for // CreateOrUpdate creates or updates a virtual network in the specified resource group.
// completion. Polling can be canceled by passing the cancel channel argument. The channel will be used to cancel
// polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
// parameters is parameters supplied to the create or update virtual network operation // parameters is parameters supplied to the create or update virtual network operation
func (client VirtualNetworksClient) CreateOrUpdate(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, cancel <-chan struct{}) (<-chan VirtualNetwork, <-chan error) { func (client VirtualNetworksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork) (result VirtualNetworksCreateOrUpdateFuture, err error) {
resultChan := make(chan VirtualNetwork, 1) req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, virtualNetworkName, parameters)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request")
var err error return
var result VirtualNetwork }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkName, parameters, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", nil, "Failure preparing request")
return
}
resp, err := client.CreateOrUpdateSender(req) result, err = client.CreateOrUpdateSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure sending request") return
return }
}
result, err = client.CreateOrUpdateResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "CreateOrUpdate", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// CreateOrUpdatePreparer prepares the CreateOrUpdate request. // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client VirtualNetworksClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork, cancel <-chan struct{}) (*http.Request, error) { func (client VirtualNetworksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters VirtualNetwork) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -170,16 +149,22 @@ func (client VirtualNetworksClient) CreateOrUpdatePreparer(resourceGroupName str
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters),
autorest.WithJSON(parameters), autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworksClient) CreateOrUpdateSender(req *http.Request) (future VirtualNetworksCreateOrUpdateFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated))
return
} }
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@ -195,47 +180,27 @@ func (client VirtualNetworksClient) CreateOrUpdateResponder(resp *http.Response)
return return
} }
// Delete deletes the specified virtual network. This method may poll for completion. Polling can be canceled by // Delete deletes the specified virtual network.
// passing the cancel channel argument. The channel will be used to cancel polling and any outstanding HTTP requests.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
func (client VirtualNetworksClient) Delete(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) { func (client VirtualNetworksClient) Delete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworksDeleteFuture, err error) {
resultChan := make(chan autorest.Response, 1) req, err := client.DeletePreparer(ctx, resourceGroupName, virtualNetworkName)
errChan := make(chan error, 1) if err != nil {
go func() { err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", nil, "Failure preparing request")
var err error return
var result autorest.Response }
defer func() {
if err != nil {
errChan <- err
}
resultChan <- result
close(resultChan)
close(errChan)
}()
req, err := client.DeletePreparer(resourceGroupName, virtualNetworkName, cancel)
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", nil, "Failure preparing request")
return
}
resp, err := client.DeleteSender(req) result, err = client.DeleteSender(req)
if err != nil { if err != nil {
result.Response = resp err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", result.Response(), "Failure sending request")
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", resp, "Failure sending request") return
return }
}
result, err = client.DeleteResponder(resp) return
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Delete", resp, "Failure responding to request")
}
}()
return resultChan, errChan
} }
// DeletePreparer prepares the Delete request. // DeletePreparer prepares the Delete request.
func (client VirtualNetworksClient) DeletePreparer(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (*http.Request, error) { func (client VirtualNetworksClient) DeletePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -252,16 +217,22 @@ func (client VirtualNetworksClient) DeletePreparer(resourceGroupName string, vir
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// DeleteSender sends the Delete request. The method will close the // DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworksClient) DeleteSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworksClient) DeleteSender(req *http.Request) (future VirtualNetworksDeleteFuture, err error) {
return autorest.SendWithSender(client, sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
req, future.Future = azure.NewFuture(req)
azure.DoRetryWithRegistration(client.Client), future.req = req
azure.DoPollForAsynchronous(client.PollingDelay)) _, err = future.Done(sender)
if err != nil {
return
}
err = autorest.Respond(future.Response(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
return
} }
// DeleteResponder handles the response to the Delete request. The method always // DeleteResponder handles the response to the Delete request. The method always
@ -270,7 +241,7 @@ func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result
err = autorest.Respond( err = autorest.Respond(
resp, resp,
client.ByInspecting(), client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusNoContent, http.StatusOK), azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing()) autorest.ByClosing())
result.Response = resp result.Response = resp
return return
@ -280,8 +251,8 @@ func (client VirtualNetworksClient) DeleteResponder(resp *http.Response) (result
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. expand // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. expand
// is expands referenced resources. // is expands referenced resources.
func (client VirtualNetworksClient) Get(resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) { func (client VirtualNetworksClient) Get(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (result VirtualNetwork, err error) {
req, err := client.GetPreparer(resourceGroupName, virtualNetworkName, expand) req, err := client.GetPreparer(ctx, resourceGroupName, virtualNetworkName, expand)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "Get", nil, "Failure preparing request")
return return
@ -303,7 +274,7 @@ func (client VirtualNetworksClient) Get(resourceGroupName string, virtualNetwork
} }
// GetPreparer prepares the Get request. // GetPreparer prepares the Get request.
func (client VirtualNetworksClient) GetPreparer(resourceGroupName string, virtualNetworkName string, expand string) (*http.Request, error) { func (client VirtualNetworksClient) GetPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -323,14 +294,13 @@ func (client VirtualNetworksClient) GetPreparer(resourceGroupName string, virtua
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// GetSender sends the Get request. The method will close the // GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworksClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -350,8 +320,9 @@ func (client VirtualNetworksClient) GetResponder(resp *http.Response) (result Vi
// List gets all virtual networks in a resource group. // List gets all virtual networks in a resource group.
// //
// resourceGroupName is the name of the resource group. // resourceGroupName is the name of the resource group.
func (client VirtualNetworksClient) List(resourceGroupName string) (result VirtualNetworkListResult, err error) { func (client VirtualNetworksClient) List(ctx context.Context, resourceGroupName string) (result VirtualNetworkListResultPage, err error) {
req, err := client.ListPreparer(resourceGroupName) result.fn = client.listNextResults
req, err := client.ListPreparer(ctx, resourceGroupName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing request")
return return
@ -359,12 +330,12 @@ func (client VirtualNetworksClient) List(resourceGroupName string) (result Virtu
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.vnlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending request")
return return
} }
result, err = client.ListResponder(resp) result.vnlr, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to request")
} }
@ -373,7 +344,7 @@ func (client VirtualNetworksClient) List(resourceGroupName string) (result Virtu
} }
// ListPreparer prepares the List request. // ListPreparer prepares the List request.
func (client VirtualNetworksClient) ListPreparer(resourceGroupName string) (*http.Request, error) { func (client VirtualNetworksClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -389,14 +360,13 @@ func (client VirtualNetworksClient) ListPreparer(resourceGroupName string) (*htt
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListSender sends the List request. The method will close the // ListSender sends the List request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworksClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -413,78 +383,37 @@ func (client VirtualNetworksClient) ListResponder(resp *http.Response) (result V
return return
} }
// ListNextResults retrieves the next set of results, if any. // listNextResults retrieves the next set of results, if any.
func (client VirtualNetworksClient) ListNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { func (client VirtualNetworksClient) listNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) {
req, err := lastResults.VirtualNetworkListResultPreparer() req, err := lastResults.virtualNetworkListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListSender(req) resp, err := client.ListSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListResponder(resp) result, err = client.ListResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "List", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListComplete gets all elements from the list without paging. // ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client VirtualNetworksClient) ListComplete(resourceGroupName string, cancel <-chan struct{}) (<-chan VirtualNetwork, <-chan error) { func (client VirtualNetworksClient) ListComplete(ctx context.Context, resourceGroupName string) (result VirtualNetworkListResultIterator, err error) {
resultChan := make(chan VirtualNetwork) result.page, err = client.List(ctx, resourceGroupName)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.List(resourceGroupName)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
// ListAll gets all virtual networks in a subscription. // ListAll gets all virtual networks in a subscription.
func (client VirtualNetworksClient) ListAll() (result VirtualNetworkListResult, err error) { func (client VirtualNetworksClient) ListAll(ctx context.Context) (result VirtualNetworkListResultPage, err error) {
req, err := client.ListAllPreparer() result.fn = client.listAllNextResults
req, err := client.ListAllPreparer(ctx)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing request")
return return
@ -492,12 +421,12 @@ func (client VirtualNetworksClient) ListAll() (result VirtualNetworkListResult,
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.vnlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending request")
return return
} }
result, err = client.ListAllResponder(resp) result.vnlr, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to request")
} }
@ -506,7 +435,7 @@ func (client VirtualNetworksClient) ListAll() (result VirtualNetworkListResult,
} }
// ListAllPreparer prepares the ListAll request. // ListAllPreparer prepares the ListAll request.
func (client VirtualNetworksClient) ListAllPreparer() (*http.Request, error) { func (client VirtualNetworksClient) ListAllPreparer(ctx context.Context) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
} }
@ -521,14 +450,13 @@ func (client VirtualNetworksClient) ListAllPreparer() (*http.Request, error) {
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/virtualNetworks", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListAllSender sends the ListAll request. The method will close the // ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworksClient) ListAllSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworksClient) ListAllSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -545,80 +473,39 @@ func (client VirtualNetworksClient) ListAllResponder(resp *http.Response) (resul
return return
} }
// ListAllNextResults retrieves the next set of results, if any. // listAllNextResults retrieves the next set of results, if any.
func (client VirtualNetworksClient) ListAllNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) { func (client VirtualNetworksClient) listAllNextResults(lastResults VirtualNetworkListResult) (result VirtualNetworkListResult, err error) {
req, err := lastResults.VirtualNetworkListResultPreparer() req, err := lastResults.virtualNetworkListResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listAllNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListAllSender(req) resp, err := client.ListAllSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listAllNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListAllResponder(resp) result, err = client.ListAllResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListAll", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listAllNextResults", resp, "Failure responding to next results request")
} }
return return
} }
// ListAllComplete gets all elements from the list without paging. // ListAllComplete enumerates all values, automatically crossing page boundaries as required.
func (client VirtualNetworksClient) ListAllComplete(cancel <-chan struct{}) (<-chan VirtualNetwork, <-chan error) { func (client VirtualNetworksClient) ListAllComplete(ctx context.Context) (result VirtualNetworkListResultIterator, err error) {
resultChan := make(chan VirtualNetwork) result.page, err = client.ListAll(ctx)
errChan := make(chan error, 1) return
go func() {
defer func() {
close(resultChan)
close(errChan)
}()
list, err := client.ListAll()
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
for list.NextLink != nil {
list, err = client.ListAllNextResults(list)
if err != nil {
errChan <- err
return
}
if list.Value != nil {
for _, item := range *list.Value {
select {
case <-cancel:
return
case resultChan <- item:
// Intentionally left blank
}
}
}
}
}()
return resultChan, errChan
} }
// ListUsage lists usage stats. // ListUsage lists usage stats.
// //
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network. // resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
func (client VirtualNetworksClient) ListUsage(resourceGroupName string, virtualNetworkName string) (result VirtualNetworkListUsageResult, err error) { func (client VirtualNetworksClient) ListUsage(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkListUsageResultPage, err error) {
req, err := client.ListUsagePreparer(resourceGroupName, virtualNetworkName) result.fn = client.listUsageNextResults
req, err := client.ListUsagePreparer(ctx, resourceGroupName, virtualNetworkName)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", nil, "Failure preparing request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", nil, "Failure preparing request")
return return
@ -626,12 +513,12 @@ func (client VirtualNetworksClient) ListUsage(resourceGroupName string, virtualN
resp, err := client.ListUsageSender(req) resp, err := client.ListUsageSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.vnlur.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", resp, "Failure sending request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", resp, "Failure sending request")
return return
} }
result, err = client.ListUsageResponder(resp) result.vnlur, err = client.ListUsageResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", resp, "Failure responding to request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", resp, "Failure responding to request")
} }
@ -640,7 +527,7 @@ func (client VirtualNetworksClient) ListUsage(resourceGroupName string, virtualN
} }
// ListUsagePreparer prepares the ListUsage request. // ListUsagePreparer prepares the ListUsage request.
func (client VirtualNetworksClient) ListUsagePreparer(resourceGroupName string, virtualNetworkName string) (*http.Request, error) { func (client VirtualNetworksClient) ListUsagePreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string) (*http.Request, error) {
pathParameters := map[string]interface{}{ pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID), "subscriptionId": autorest.Encode("path", client.SubscriptionID),
@ -657,14 +544,13 @@ func (client VirtualNetworksClient) ListUsagePreparer(resourceGroupName string,
autorest.WithBaseURL(client.BaseURI), autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages", pathParameters), autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/usages", pathParameters),
autorest.WithQueryParameters(queryParameters)) autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{}) return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
// ListUsageSender sends the ListUsage request. The method will close the // ListUsageSender sends the ListUsage request. The method will close the
// http.Response Body if it receives an error. // http.Response Body if it receives an error.
func (client VirtualNetworksClient) ListUsageSender(req *http.Request) (*http.Response, error) { func (client VirtualNetworksClient) ListUsageSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, return autorest.SendWithSender(client, req,
req,
azure.DoRetryWithRegistration(client.Client)) azure.DoRetryWithRegistration(client.Client))
} }
@ -681,71 +567,100 @@ func (client VirtualNetworksClient) ListUsageResponder(resp *http.Response) (res
return return
} }
// ListUsageNextResults retrieves the next set of results, if any. // listUsageNextResults retrieves the next set of results, if any.
func (client VirtualNetworksClient) ListUsageNextResults(lastResults VirtualNetworkListUsageResult) (result VirtualNetworkListUsageResult, err error) { func (client VirtualNetworksClient) listUsageNextResults(lastResults VirtualNetworkListUsageResult) (result VirtualNetworkListUsageResult, err error) {
req, err := lastResults.VirtualNetworkListUsageResultPreparer() req, err := lastResults.virtualNetworkListUsageResultPreparer()
if err != nil { if err != nil {
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", nil, "Failure preparing next results request") return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listUsageNextResults", nil, "Failure preparing next results request")
} }
if req == nil { if req == nil {
return return
} }
resp, err := client.ListUsageSender(req) resp, err := client.ListUsageSender(req)
if err != nil { if err != nil {
result.Response = autorest.Response{Response: resp} result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", resp, "Failure sending next results request") return result, autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listUsageNextResults", resp, "Failure sending next results request")
} }
result, err = client.ListUsageResponder(resp) result, err = client.ListUsageResponder(resp)
if err != nil { if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "ListUsage", resp, "Failure responding to next results request") err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "listUsageNextResults", resp, "Failure responding to next results request")
}
return
}
// ListUsageComplete enumerates all values, automatically crossing page boundaries as required.
func (client VirtualNetworksClient) ListUsageComplete(ctx context.Context, resourceGroupName string, virtualNetworkName string) (result VirtualNetworkListUsageResultIterator, err error) {
result.page, err = client.ListUsage(ctx, resourceGroupName, virtualNetworkName)
return
}
// UpdateTags updates a virtual network tags.
//
// resourceGroupName is the name of the resource group. virtualNetworkName is the name of the virtual network.
// parameters is parameters supplied to update virtual network tags.
func (client VirtualNetworksClient) UpdateTags(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters TagsObject) (result VirtualNetworksUpdateTagsFuture, err error) {
req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, virtualNetworkName, parameters)
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "UpdateTags", nil, "Failure preparing request")
return
}
result, err = client.UpdateTagsSender(req)
if err != nil {
err = autorest.NewErrorWithError(err, "network.VirtualNetworksClient", "UpdateTags", result.Response(), "Failure sending request")
return
} }
return return
} }
// ListUsageComplete gets all elements from the list without paging. // UpdateTagsPreparer prepares the UpdateTags request.
func (client VirtualNetworksClient) ListUsageComplete(resourceGroupName string, virtualNetworkName string, cancel <-chan struct{}) (<-chan VirtualNetworkUsage, <-chan error) { func (client VirtualNetworksClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, virtualNetworkName string, parameters TagsObject) (*http.Request, error) {
resultChan := make(chan VirtualNetworkUsage) pathParameters := map[string]interface{}{
errChan := make(chan error, 1) "resourceGroupName": autorest.Encode("path", resourceGroupName),
go func() { "subscriptionId": autorest.Encode("path", client.SubscriptionID),
defer func() { "virtualNetworkName": autorest.Encode("path", virtualNetworkName),
close(resultChan) }
close(errChan)
}() const APIVersion = "2017-09-01"
list, err := client.ListUsage(resourceGroupName, virtualNetworkName) queryParameters := map[string]interface{}{
if err != nil { "api-version": APIVersion,
errChan <- err }
return
} preparer := autorest.CreatePreparer(
if list.Value != nil { autorest.AsJSON(),
for _, item := range *list.Value { autorest.AsPatch(),
select { autorest.WithBaseURL(client.BaseURI),
case <-cancel: autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}", pathParameters),
return autorest.WithJSON(parameters),
case resultChan <- item: autorest.WithQueryParameters(queryParameters))
// Intentionally left blank return preparer.Prepare((&http.Request{}).WithContext(ctx))
} }
}
} // UpdateTagsSender sends the UpdateTags request. The method will close the
for list.NextLink != nil { // http.Response Body if it receives an error.
list, err = client.ListUsageNextResults(list) func (client VirtualNetworksClient) UpdateTagsSender(req *http.Request) (future VirtualNetworksUpdateTagsFuture, err error) {
if err != nil { sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
errChan <- err future.Future = azure.NewFuture(req)
return future.req = req
} _, err = future.Done(sender)
if list.Value != nil { if err != nil {
for _, item := range *list.Value { return
select { }
case <-cancel: err = autorest.Respond(future.Response(),
return azure.WithErrorUnlessStatusCode(http.StatusOK))
case resultChan <- item: return
// Intentionally left blank }
}
} // UpdateTagsResponder handles the response to the UpdateTags request. The method always
} // closes the http.Response Body.
} func (client VirtualNetworksClient) UpdateTagsResponder(resp *http.Response) (result VirtualNetwork, err error) {
}() err = autorest.Respond(
return resultChan, errChan resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
} }