Merge remote-tracking branch 'upstream/master' into packer-builder-profitbricks
# Conflicts: # Godeps/Godeps.json
This commit is contained in:
commit
92e0f2bf4c
|
@ -9,8 +9,12 @@
|
|||
.idea
|
||||
test/.env
|
||||
*~
|
||||
*.received.*
|
||||
|
||||
website/.bundle
|
||||
website/vendor
|
||||
|
||||
packer-test*.log
|
||||
|
||||
*.received.txt
|
||||
*.received.json
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"ImportPath": "github.com/StackPointCloud/packer",
|
||||
"ImportPath": "github.com/mitchellh/packer",
|
||||
"GoVersion": "go1.6",
|
||||
"GodepVersion": "v74",
|
||||
"Deps": [
|
||||
|
@ -10,53 +10,53 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/compute",
|
||||
"Comment": "v2.1.1-beta",
|
||||
"Rev": "a1883f7b98346e4908a6c25230c95a8a3026a10c"
|
||||
"Comment": "v3.1.0-beta",
|
||||
"Rev": "902d95d9f311ae585ee98cfd18f418b467d60d5a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/network",
|
||||
"Comment": "v2.1.1-beta",
|
||||
"Rev": "a1883f7b98346e4908a6c25230c95a8a3026a10c"
|
||||
"Comment": "v3.1.0-beta",
|
||||
"Rev": "902d95d9f311ae585ee98cfd18f418b467d60d5a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/resources/resources",
|
||||
"Comment": "v2.1.1-beta",
|
||||
"Rev": "a1883f7b98346e4908a6c25230c95a8a3026a10c"
|
||||
"Comment": "v3.1.0-beta",
|
||||
"Rev": "902d95d9f311ae585ee98cfd18f418b467d60d5a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/resources/subscriptions",
|
||||
"Comment": "v2.1.1-beta",
|
||||
"Rev": "a1883f7b98346e4908a6c25230c95a8a3026a10c"
|
||||
"Comment": "v3.1.0-beta",
|
||||
"Rev": "902d95d9f311ae585ee98cfd18f418b467d60d5a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/azure-sdk-for-go/arm/storage",
|
||||
"Comment": "v2.1.1-beta",
|
||||
"Rev": "a1883f7b98346e4908a6c25230c95a8a3026a10c"
|
||||
"Comment": "v3.1.0-beta",
|
||||
"Rev": "902d95d9f311ae585ee98cfd18f418b467d60d5a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/azure-sdk-for-go/storage",
|
||||
"Comment": "v2.1.1-beta",
|
||||
"Rev": "a1883f7b98346e4908a6c25230c95a8a3026a10c"
|
||||
"Comment": "v3.1.0-beta",
|
||||
"Rev": "902d95d9f311ae585ee98cfd18f418b467d60d5a"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/go-autorest/autorest",
|
||||
"Comment": "v7.0.6",
|
||||
"Rev": "451ba0760a7fd73d7175e2d3d1c3911020619561"
|
||||
"Comment": "v7.0.7",
|
||||
"Rev": "6f40a8acfe03270d792cb8155e2942c09d7cff95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/go-autorest/autorest/azure",
|
||||
"Comment": "v7.0.6",
|
||||
"Rev": "451ba0760a7fd73d7175e2d3d1c3911020619561"
|
||||
"Comment": "v7.0.7",
|
||||
"Rev": "6f40a8acfe03270d792cb8155e2942c09d7cff95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/go-autorest/autorest/date",
|
||||
"Comment": "v7.0.6",
|
||||
"Rev": "451ba0760a7fd73d7175e2d3d1c3911020619561"
|
||||
"Comment": "v7.0.7",
|
||||
"Rev": "6f40a8acfe03270d792cb8155e2942c09d7cff95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/go-autorest/autorest/to",
|
||||
"Comment": "v7.0.6",
|
||||
"Rev": "451ba0760a7fd73d7175e2d3d1c3911020619561"
|
||||
"Comment": "v7.0.7",
|
||||
"Rev": "6f40a8acfe03270d792cb8155e2942c09d7cff95"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/go-ntlmssp",
|
||||
|
@ -66,6 +66,18 @@
|
|||
"ImportPath": "github.com/armon/go-radix",
|
||||
"Rev": "4239b77079c7b5d1243b7b4736304ce8ddb6f0f2"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/approvals/go-approval-tests",
|
||||
"Rev": "ad96e53bea43a905c17beeb983a0f9ce087dc48d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/approvals/go-approval-tests/reporters",
|
||||
"Rev": "ad96e53bea43a905c17beeb983a0f9ce087dc48d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/approvals/go-approval-tests/utils",
|
||||
"Rev": "ad96e53bea43a905c17beeb983a0f9ce087dc48d"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/aws/aws-sdk-go/aws",
|
||||
"Comment": "v1.1.2",
|
||||
|
@ -211,8 +223,8 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/dgrijalva/jwt-go",
|
||||
"Comment": "v2.4.0-11-gf219341",
|
||||
"Rev": "f2193411bd642f7db03249fd79d5292c9b34916a"
|
||||
"Comment": "v3.0.0",
|
||||
"Rev": "d2709f9f1f31ebcda9651b03077758c1f3a0018c"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/digitalocean/godo",
|
||||
|
@ -270,6 +282,10 @@
|
|||
"ImportPath": "github.com/hashicorp/go-rootcerts",
|
||||
"Rev": "6bb64b370b90e7ef1fa532be9e591a81c3493e00"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/go-uuid",
|
||||
"Rev": "73d19cdc2bf00788cc25f7d5fd74347d48ada9ac"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/hashicorp/go-version",
|
||||
"Rev": "7e3c02b30806fa5779d3bdfc152ce4c6f40e7b38"
|
||||
|
@ -379,371 +395,6 @@
|
|||
"ImportPath": "github.com/mitchellh/multistep",
|
||||
"Rev": "162146fc57112954184d90266f4733e900ed05a5"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/amazon/chroot",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/amazon/common",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/amazon/ebs",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/amazon/instance",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/azure/arm",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/azure/common",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/azure/common/constants",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/azure/common/lin",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/azure/common/logutil",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/azure/common/template",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/azure/pkcs12",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/azure/pkcs12/rc2",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/digitalocean",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/docker",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/file",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/googlecompute",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/null",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/openstack",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/parallels/common",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/parallels/iso",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/parallels/pvm",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/qemu",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/virtualbox/common",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/virtualbox/iso",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/virtualbox/ovf",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/vmware/common",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/vmware/iso",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/builder/vmware/vmx",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/command",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/common",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/common/ssh",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/common/uuid",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/communicator/none",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/communicator/ssh",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/communicator/winrm",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/fix",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/helper/communicator",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/helper/config",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/helper/flag-kv",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/helper/flag-slice",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/packer",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/packer/plugin",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/packer/rpc",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/amazon-import",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/artifice",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/atlas",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/checksum",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/compress",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/docker-import",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/docker-push",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/docker-save",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/docker-tag",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/shell-local",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/vagrant",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/vagrant-cloud",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/post-processor/vsphere",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/ansible",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/ansible-local",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/chef-client",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/chef-solo",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/file",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/powershell",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/puppet-masterless",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/puppet-server",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/salt-masterless",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/shell",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/shell-local",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/windows-restart",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/provisioner/windows-shell",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/template",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/template/interpolate",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/packer/version",
|
||||
"Comment": "v0.10.1-120-gc8f68af",
|
||||
"Rev": "c8f68afa5c3b39259fd7ec74877ab80640358e0f"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/mitchellh/panicwrap",
|
||||
"Rev": "a1e50bc201f387747a45ffff020f1af2d8759e88"
|
||||
|
@ -999,8 +650,29 @@
|
|||
"Rev": "860cbeca3ebcc600db0b213c0e83ad6ce91f5739"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/profitbricks/profitbricks-sdk-go",
|
||||
"Rev": "9dea2c24a0dc0740d93fd621ce845a1faede6826"
|
||||
"ImportPath": "github.com/Azure/azure-sdk-for-go/vendor/github.com/Azure/go-autorest/autorest",
|
||||
"Comment": "v7.0.5-4-g0a0ee7d",
|
||||
"Rev": "0a0ee7d5b9b1b3d980434cbb0afff33e9ca9e907"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/azure-sdk-for-go/vendor/github.com/Azure/go-autorest/autorest/azure",
|
||||
"Comment": "v7.0.5-4-g0a0ee7d",
|
||||
"Rev": "0a0ee7d5b9b1b3d980434cbb0afff33e9ca9e907"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/azure-sdk-for-go/vendor/github.com/Azure/go-autorest/autorest/date",
|
||||
"Comment": "v7.0.5-4-g0a0ee7d",
|
||||
"Rev": "0a0ee7d5b9b1b3d980434cbb0afff33e9ca9e907"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/azure-sdk-for-go/vendor/github.com/Azure/go-autorest/autorest/to",
|
||||
"Comment": "v7.0.5-4-g0a0ee7d",
|
||||
"Rev": "0a0ee7d5b9b1b3d980434cbb0afff33e9ca9e907"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/Azure/azure-sdk-for-go/vendor/github.com/dgrijalva/jwt-go",
|
||||
"Comment": "v3.0.0-2-gf077707",
|
||||
"Rev": "f0777076321ab64f6efc15a82d9d23b98539b943"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -166,7 +166,6 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
|
|||
BlockDeviceMappings: s.BlockDevices.BuildLaunchDevices(),
|
||||
Placement: &ec2.Placement{AvailabilityZone: &s.AvailabilityZone},
|
||||
EbsOptimized: &s.EbsOptimized,
|
||||
InstanceInitiatedShutdownBehavior: &s.InstanceInitiatedShutdownBehavior,
|
||||
}
|
||||
|
||||
if s.SubnetId != "" && s.AssociatePublicIpAddress {
|
||||
|
@ -184,6 +183,10 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
|
|||
runOpts.SecurityGroupIds = securityGroupIds
|
||||
}
|
||||
|
||||
if s.ExpectedRootDevice == "ebs" {
|
||||
runOpts.InstanceInitiatedShutdownBehavior = &s.InstanceInitiatedShutdownBehavior
|
||||
}
|
||||
|
||||
runResp, err := ec2conn.RunInstances(runOpts)
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Error launching source instance: %s", err)
|
||||
|
|
|
@ -204,21 +204,20 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
VpcId: b.config.VpcId,
|
||||
},
|
||||
&awscommon.StepRunSourceInstance{
|
||||
Debug: b.config.PackerDebug,
|
||||
SpotPrice: b.config.SpotPrice,
|
||||
SpotPriceProduct: b.config.SpotPriceAutoProduct,
|
||||
InstanceType: b.config.InstanceType,
|
||||
IamInstanceProfile: b.config.IamInstanceProfile,
|
||||
UserData: b.config.UserData,
|
||||
UserDataFile: b.config.UserDataFile,
|
||||
SourceAMI: b.config.SourceAmi,
|
||||
SubnetId: b.config.SubnetId,
|
||||
AssociatePublicIpAddress: b.config.AssociatePublicIpAddress,
|
||||
EbsOptimized: b.config.EbsOptimized,
|
||||
AvailabilityZone: b.config.AvailabilityZone,
|
||||
BlockDevices: b.config.BlockDevices,
|
||||
Tags: b.config.RunTags,
|
||||
InstanceInitiatedShutdownBehavior: b.config.InstanceInitiatedShutdownBehavior,
|
||||
Debug: b.config.PackerDebug,
|
||||
SpotPrice: b.config.SpotPrice,
|
||||
SpotPriceProduct: b.config.SpotPriceAutoProduct,
|
||||
InstanceType: b.config.InstanceType,
|
||||
IamInstanceProfile: b.config.IamInstanceProfile,
|
||||
UserData: b.config.UserData,
|
||||
UserDataFile: b.config.UserDataFile,
|
||||
SourceAMI: b.config.SourceAmi,
|
||||
SubnetId: b.config.SubnetId,
|
||||
AssociatePublicIpAddress: b.config.AssociatePublicIpAddress,
|
||||
EbsOptimized: b.config.EbsOptimized,
|
||||
AvailabilityZone: b.config.AvailabilityZone,
|
||||
BlockDevices: b.config.BlockDevices,
|
||||
Tags: b.config.RunTags,
|
||||
},
|
||||
&awscommon.StepGetPassword{
|
||||
Debug: b.config.PackerDebug,
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/networkInterfaces"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"linuxConfiguration": {
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"keyData": "",
|
||||
"path": "[variables('sshKeyPath')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"osDisk": {
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage",
|
||||
"image": {
|
||||
"uri": "https://localhost/custom.vhd"
|
||||
},
|
||||
"name": "osdisk",
|
||||
"osType": "Linux",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Microsoft.Compute/virtualMachines"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "ignore",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "ignore",
|
||||
"virtualNetworkResourceGroup": "ignore",
|
||||
"vmStorageAccountContainerName": "images",
|
||||
"vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ func getFakeSasUrl(name string) string {
|
|||
func TestArtifactString(t *testing.T) {
|
||||
template := CaptureTemplate{
|
||||
Resources: []CaptureResources{
|
||||
CaptureResources{
|
||||
{
|
||||
Properties: CaptureProperties{
|
||||
StorageProfile: CaptureStorageProfile{
|
||||
OSDisk: CaptureDisk{
|
||||
|
@ -57,7 +57,7 @@ func TestArtifactString(t *testing.T) {
|
|||
func TestArtifactProperties(t *testing.T) {
|
||||
template := CaptureTemplate{
|
||||
Resources: []CaptureResources{
|
||||
CaptureResources{
|
||||
{
|
||||
Properties: CaptureProperties{
|
||||
StorageProfile: CaptureStorageProfile{
|
||||
OSDisk: CaptureDisk{
|
||||
|
@ -97,7 +97,7 @@ func TestArtifactProperties(t *testing.T) {
|
|||
func TestArtifactOverHypenatedCaptureUri(t *testing.T) {
|
||||
template := CaptureTemplate{
|
||||
Resources: []CaptureResources{
|
||||
CaptureResources{
|
||||
{
|
||||
Properties: CaptureProperties{
|
||||
StorageProfile: CaptureStorageProfile{
|
||||
OSDisk: CaptureDisk{
|
||||
|
@ -134,7 +134,7 @@ func TestArtifactRejectMalformedTemplates(t *testing.T) {
|
|||
func TestArtifactRejectMalformedStorageUri(t *testing.T) {
|
||||
template := CaptureTemplate{
|
||||
Resources: []CaptureResources{
|
||||
CaptureResources{
|
||||
{
|
||||
Properties: CaptureProperties{
|
||||
StorageProfile: CaptureStorageProfile{
|
||||
OSDisk: CaptureDisk{
|
||||
|
|
|
@ -26,7 +26,7 @@ func (a *Authenticate) getServicePrincipalToken() (*azure.ServicePrincipalToken,
|
|||
}
|
||||
|
||||
func (a *Authenticate) getServicePrincipalTokenWithResource(resource string) (*azure.ServicePrincipalToken, error) {
|
||||
oauthConfig, err := newOAuthConfigWithTenant(a.tenantID)
|
||||
oauthConfig, err := a.env.OAuthConfigForTenant(a.tenantID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -39,7 +39,3 @@ func (a *Authenticate) getServicePrincipalTokenWithResource(resource string) (*a
|
|||
|
||||
return spt, err
|
||||
}
|
||||
|
||||
func newOAuthConfigWithTenant(tenantID string) (*azure.OAuthConfig, error) {
|
||||
return azure.PublicCloud.OAuthConfigForTenant(tenantID)
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
"fmt"
|
||||
"math"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"strconv"
|
||||
|
||||
|
@ -35,6 +36,9 @@ type AzureClient struct {
|
|||
resources.DeploymentsClient
|
||||
resources.GroupsClient
|
||||
network.PublicIPAddressesClient
|
||||
network.InterfacesClient
|
||||
network.SubnetsClient
|
||||
network.VirtualNetworksClient
|
||||
compute.VirtualMachinesClient
|
||||
common.VaultClient
|
||||
armStorage.AccountsClient
|
||||
|
@ -102,43 +106,67 @@ func byConcatDecorators(decorators ...autorest.RespondDecorator) autorest.Respon
|
|||
}
|
||||
|
||||
func NewAzureClient(subscriptionID, resourceGroupName, storageAccountName string,
|
||||
cloud *azure.Environment,
|
||||
servicePrincipalToken, servicePrincipalTokenVault *azure.ServicePrincipalToken) (*AzureClient, error) {
|
||||
|
||||
var azureClient = &AzureClient{}
|
||||
|
||||
maxlen := getInspectorMaxLength()
|
||||
|
||||
azureClient.DeploymentsClient = resources.NewDeploymentsClient(subscriptionID)
|
||||
azureClient.DeploymentsClient = resources.NewDeploymentsClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID)
|
||||
azureClient.DeploymentsClient.Authorizer = servicePrincipalToken
|
||||
azureClient.DeploymentsClient.RequestInspector = withInspection(maxlen)
|
||||
azureClient.DeploymentsClient.ResponseInspector = byInspecting(maxlen)
|
||||
azureClient.DeploymentsClient.UserAgent += packerUserAgent
|
||||
|
||||
azureClient.GroupsClient = resources.NewGroupsClient(subscriptionID)
|
||||
azureClient.GroupsClient = resources.NewGroupsClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID)
|
||||
azureClient.GroupsClient.Authorizer = servicePrincipalToken
|
||||
azureClient.GroupsClient.RequestInspector = withInspection(maxlen)
|
||||
azureClient.GroupsClient.ResponseInspector = byInspecting(maxlen)
|
||||
azureClient.GroupsClient.UserAgent += packerUserAgent
|
||||
|
||||
azureClient.PublicIPAddressesClient = network.NewPublicIPAddressesClient(subscriptionID)
|
||||
azureClient.InterfacesClient = network.NewInterfacesClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID)
|
||||
azureClient.InterfacesClient.Authorizer = servicePrincipalToken
|
||||
azureClient.InterfacesClient.RequestInspector = withInspection(maxlen)
|
||||
azureClient.InterfacesClient.ResponseInspector = byInspecting(maxlen)
|
||||
azureClient.InterfacesClient.UserAgent += packerUserAgent
|
||||
|
||||
azureClient.SubnetsClient = network.NewSubnetsClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID)
|
||||
azureClient.SubnetsClient.Authorizer = servicePrincipalToken
|
||||
azureClient.SubnetsClient.RequestInspector = withInspection(maxlen)
|
||||
azureClient.SubnetsClient.ResponseInspector = byInspecting(maxlen)
|
||||
azureClient.SubnetsClient.UserAgent += packerUserAgent
|
||||
|
||||
azureClient.VirtualNetworksClient = network.NewVirtualNetworksClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID)
|
||||
azureClient.VirtualNetworksClient.Authorizer = servicePrincipalToken
|
||||
azureClient.VirtualNetworksClient.RequestInspector = withInspection(maxlen)
|
||||
azureClient.VirtualNetworksClient.ResponseInspector = byInspecting(maxlen)
|
||||
azureClient.VirtualNetworksClient.UserAgent += packerUserAgent
|
||||
|
||||
azureClient.PublicIPAddressesClient = network.NewPublicIPAddressesClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID)
|
||||
azureClient.PublicIPAddressesClient.Authorizer = servicePrincipalToken
|
||||
azureClient.PublicIPAddressesClient.RequestInspector = withInspection(maxlen)
|
||||
azureClient.PublicIPAddressesClient.ResponseInspector = byInspecting(maxlen)
|
||||
azureClient.PublicIPAddressesClient.UserAgent += packerUserAgent
|
||||
|
||||
azureClient.VirtualMachinesClient = compute.NewVirtualMachinesClient(subscriptionID)
|
||||
azureClient.VirtualMachinesClient = compute.NewVirtualMachinesClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID)
|
||||
azureClient.VirtualMachinesClient.Authorizer = servicePrincipalToken
|
||||
azureClient.VirtualMachinesClient.RequestInspector = withInspection(maxlen)
|
||||
azureClient.VirtualMachinesClient.ResponseInspector = byConcatDecorators(byInspecting(maxlen), templateCapture(azureClient))
|
||||
azureClient.VirtualMachinesClient.UserAgent += packerUserAgent
|
||||
|
||||
azureClient.AccountsClient = armStorage.NewAccountsClient(subscriptionID)
|
||||
azureClient.AccountsClient = armStorage.NewAccountsClientWithBaseURI(cloud.ResourceManagerEndpoint, subscriptionID)
|
||||
azureClient.AccountsClient.Authorizer = servicePrincipalToken
|
||||
azureClient.AccountsClient.RequestInspector = withInspection(maxlen)
|
||||
azureClient.AccountsClient.ResponseInspector = byInspecting(maxlen)
|
||||
azureClient.AccountsClient.UserAgent += packerUserAgent
|
||||
|
||||
azureClient.VaultClient = common.VaultClient{}
|
||||
keyVaultURL, err := url.Parse(cloud.KeyVaultEndpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
azureClient.VaultClient = common.NewVaultClient(*keyVaultURL)
|
||||
azureClient.VaultClient.Authorizer = servicePrincipalTokenVault
|
||||
azureClient.VaultClient.RequestInspector = withInspection(maxlen)
|
||||
azureClient.VaultClient.ResponseInspector = byInspecting(maxlen)
|
||||
|
@ -149,7 +177,13 @@ func NewAzureClient(subscriptionID, resourceGroupName, storageAccountName string
|
|||
return nil, err
|
||||
}
|
||||
|
||||
storageClient, err := storage.NewBasicClient(storageAccountName, *accountKeys.Key1)
|
||||
storageClient, err := storage.NewClient(
|
||||
storageAccountName,
|
||||
*(*accountKeys.Keys)[0].Value,
|
||||
cloud.StorageEndpointSuffix,
|
||||
storage.DefaultAPIVersion,
|
||||
true /*useHttps*/)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
packerAzureCommon "github.com/mitchellh/packer/builder/azure/common"
|
||||
|
@ -20,7 +21,6 @@ import (
|
|||
packerCommon "github.com/mitchellh/packer/common"
|
||||
"github.com/mitchellh/packer/helper/communicator"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Builder struct {
|
||||
|
@ -30,6 +30,7 @@ type Builder struct {
|
|||
}
|
||||
|
||||
const (
|
||||
DefaultNicName = "packerNic"
|
||||
DefaultPublicIPAddressName = "packerPublicIP"
|
||||
DefaultSasBlobContainer = "system/Microsoft.Compute"
|
||||
DefaultSasBlobPermission = "r"
|
||||
|
@ -74,6 +75,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
b.config.SubscriptionID,
|
||||
b.config.ResourceGroupName,
|
||||
b.config.StorageAccount,
|
||||
b.config.cloudEnvironment,
|
||||
spnCloud,
|
||||
spnKeyVault)
|
||||
|
||||
|
@ -81,11 +83,21 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
return nil, err
|
||||
}
|
||||
|
||||
resolver := newResourceResolver(azureClient)
|
||||
if err := resolver.Resolve(b.config); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
b.config.storageAccountBlobEndpoint, err = b.getBlobEndpoint(azureClient, b.config.ResourceGroupName, b.config.StorageAccount)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
endpointConnectType := PublicEndpoint
|
||||
if b.isPrivateNetworkCommunication() {
|
||||
endpointConnectType = PrivateEndpoint
|
||||
}
|
||||
|
||||
b.setTemplateParameters(b.stateBag)
|
||||
var steps []multistep.Step
|
||||
|
||||
|
@ -94,7 +106,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
NewStepCreateResourceGroup(azureClient, ui),
|
||||
NewStepValidateTemplate(azureClient, ui, b.config, GetVirtualMachineDeployment),
|
||||
NewStepDeployTemplate(azureClient, ui, b.config, GetVirtualMachineDeployment),
|
||||
NewStepGetIPAddress(azureClient, ui),
|
||||
NewStepGetIPAddress(azureClient, ui, endpointConnectType),
|
||||
&communicator.StepConnectSSH{
|
||||
Config: &b.config.Comm,
|
||||
Host: lin.SSHHost,
|
||||
|
@ -116,7 +128,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
NewStepSetCertificate(b.config, ui),
|
||||
NewStepValidateTemplate(azureClient, ui, b.config, GetVirtualMachineDeployment),
|
||||
NewStepDeployTemplate(azureClient, ui, b.config, GetVirtualMachineDeployment),
|
||||
NewStepGetIPAddress(azureClient, ui),
|
||||
NewStepGetIPAddress(azureClient, ui, endpointConnectType),
|
||||
&communicator.StepConnectWinRM{
|
||||
Config: &b.config.Comm,
|
||||
Host: func(stateBag multistep.StateBag) (string, error) {
|
||||
|
@ -175,6 +187,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
return &Artifact{}, nil
|
||||
}
|
||||
|
||||
func (b *Builder) isPrivateNetworkCommunication() bool {
|
||||
return b.config.VirtualNetworkName != ""
|
||||
}
|
||||
|
||||
func (b *Builder) Cancel() {
|
||||
if b.runner != nil {
|
||||
log.Println("Cancelling the step runner...")
|
||||
|
@ -212,6 +228,7 @@ func (b *Builder) configureStateBag(stateBag multistep.StateBag) {
|
|||
stateBag.Put(constants.ArmDeploymentName, b.config.tmpDeploymentName)
|
||||
stateBag.Put(constants.ArmKeyVaultName, b.config.tmpKeyVaultName)
|
||||
stateBag.Put(constants.ArmLocation, b.config.Location)
|
||||
stateBag.Put(constants.ArmNicName, DefaultNicName)
|
||||
stateBag.Put(constants.ArmPublicIPAddressName, DefaultPublicIPAddressName)
|
||||
stateBag.Put(constants.ArmResourceGroupName, b.config.tmpResourceGroupName)
|
||||
stateBag.Put(constants.ArmStorageAccountName, b.config.StorageAccount)
|
||||
|
@ -228,7 +245,7 @@ func (b *Builder) getServicePrincipalTokens(say func(string)) (*azure.ServicePri
|
|||
var err error
|
||||
|
||||
if b.config.useDeviceLogin {
|
||||
servicePrincipalToken, err = packerAzureCommon.Authenticate(*b.config.cloudEnvironment, b.config.SubscriptionID, b.config.TenantID, say)
|
||||
servicePrincipalToken, err = packerAzureCommon.Authenticate(*b.config.cloudEnvironment, b.config.TenantID, say)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -240,7 +257,9 @@ func (b *Builder) getServicePrincipalTokens(say func(string)) (*azure.ServicePri
|
|||
return nil, nil, err
|
||||
}
|
||||
|
||||
servicePrincipalTokenVault, err = auth.getServicePrincipalTokenWithResource(packerAzureCommon.AzureVaultScope)
|
||||
servicePrincipalTokenVault, err = auth.getServicePrincipalTokenWithResource(
|
||||
strings.TrimRight(b.config.cloudEnvironment.KeyVaultEndpoint, "/"))
|
||||
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ func TestStateBagShouldBePopulatedExpectedValues(t *testing.T) {
|
|||
constants.ArmComputeName,
|
||||
constants.ArmDeploymentName,
|
||||
constants.ArmLocation,
|
||||
constants.ArmNicName,
|
||||
constants.ArmResourceGroupName,
|
||||
constants.ArmStorageAccountName,
|
||||
constants.ArmVirtualMachineCaptureParameters,
|
||||
|
|
|
@ -70,11 +70,14 @@ type Config struct {
|
|||
VMSize string `mapstructure:"vm_size"`
|
||||
|
||||
// Deployment
|
||||
ResourceGroupName string `mapstructure:"resource_group_name"`
|
||||
StorageAccount string `mapstructure:"storage_account"`
|
||||
storageAccountBlobEndpoint string
|
||||
CloudEnvironmentName string `mapstructure:"cloud_environment_name"`
|
||||
cloudEnvironment *azure.Environment
|
||||
ResourceGroupName string `mapstructure:"resource_group_name"`
|
||||
StorageAccount string `mapstructure:"storage_account"`
|
||||
storageAccountBlobEndpoint string
|
||||
CloudEnvironmentName string `mapstructure:"cloud_environment_name"`
|
||||
cloudEnvironment *azure.Environment
|
||||
VirtualNetworkName string `mapstructure:"virtual_network_name"`
|
||||
VirtualNetworkSubnetName string `mapstructure:"virtual_network_subnet_name"`
|
||||
VirtualNetworkResourceGroupName string `mapstructure:"virtual_network_resource_group_name"`
|
||||
|
||||
// OS
|
||||
OSType string `mapstructure:"os_type"`
|
||||
|
@ -121,7 +124,7 @@ func (c *Config) toVirtualMachineCaptureParameters() *compute.VirtualMachineCapt
|
|||
func (c *Config) createCertificate() (string, error) {
|
||||
privateKey, err := rsa.GenerateKey(rand.Reader, 2048)
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Failed to Generate Private Key: %s", err)
|
||||
err = fmt.Errorf("Failed to Generate Private Key: %s", err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
@ -131,7 +134,7 @@ func (c *Config) createCertificate() (string, error) {
|
|||
|
||||
serialNumber, err := rand.Int(rand.Reader, new(big.Int).Lsh(big.NewInt(1), 128))
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Failed to Generate Serial Number: %v", err)
|
||||
err = fmt.Errorf("Failed to Generate Serial Number: %v", err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
@ -299,19 +302,37 @@ func setUserNamePassword(c *Config) {
|
|||
}
|
||||
|
||||
func setCloudEnvironment(c *Config) error {
|
||||
lookup := map[string]string{
|
||||
"CHINA": "AzureChinaCloud",
|
||||
"CHINACLOUD": "AzureChinaCloud",
|
||||
"AZURECHINACLOUD": "AzureChinaCloud",
|
||||
|
||||
"GERMAN": "AzureGermanCloud",
|
||||
"GERMANCLOUD": "AzureGermanCloud",
|
||||
"AZUREGERMANCLOUD": "AzureGermanCloud",
|
||||
|
||||
"GERMANY": "AzureGermanCloud",
|
||||
"GERMANYCLOUD": "AzureGermanCloud",
|
||||
"AZUREGERMANYCLOUD": "AzureGermanCloud",
|
||||
|
||||
"PUBLIC": "AzurePublicCloud",
|
||||
"PUBLICCLOUD": "AzurePublicCloud",
|
||||
"AZUREPUBLICCLOUD": "AzurePublicCloud",
|
||||
|
||||
"USGOVERNMENT": "AzureUSGovernmentCloud",
|
||||
"USGOVERNMENTCLOUD": "AzureUSGovernmentCloud",
|
||||
"AZUREUSGOVERNMENTCLOUD": "AzureUSGovernmentCloud",
|
||||
}
|
||||
|
||||
name := strings.ToUpper(c.CloudEnvironmentName)
|
||||
switch name {
|
||||
case "CHINA", "CHINACLOUD", "AZURECHINACLOUD":
|
||||
c.cloudEnvironment = &azure.ChinaCloud
|
||||
case "PUBLIC", "PUBLICCLOUD", "AZUREPUBLICCLOUD":
|
||||
c.cloudEnvironment = &azure.PublicCloud
|
||||
case "USGOVERNMENT", "USGOVERNMENTCLOUD", "AZUREUSGOVERNMENTCLOUD":
|
||||
c.cloudEnvironment = &azure.USGovernmentCloud
|
||||
default:
|
||||
envName, ok := lookup[name]
|
||||
if !ok {
|
||||
return fmt.Errorf("There is no cloud envionment matching the name '%s'!", c.CloudEnvironmentName)
|
||||
}
|
||||
|
||||
return nil
|
||||
env, err := azure.EnvironmentFromName(envName)
|
||||
c.cloudEnvironment = &env
|
||||
return err
|
||||
}
|
||||
|
||||
func provideDefaultValues(c *Config) {
|
||||
|
@ -429,6 +450,12 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) {
|
|||
if c.ResourceGroupName == "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("A resource_group_name must be specified"))
|
||||
}
|
||||
if c.VirtualNetworkName == "" && c.VirtualNetworkResourceGroupName != "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("If virtual_network_resource_group_name is specified, so must virtual_network_name"))
|
||||
}
|
||||
if c.VirtualNetworkName == "" && c.VirtualNetworkSubnetName != "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("If virtual_network_subnet_name is specified, so must virtual_network_name"))
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// OS
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
package arm
|
||||
|
||||
// Method to resolve information about the user so that a client can be
|
||||
// constructed to communicated with Azure.
|
||||
//
|
||||
// The following data are resolved.
|
||||
//
|
||||
// 1. TenantID
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/mitchellh/packer/builder/azure/common"
|
||||
|
@ -11,7 +18,9 @@ type configRetriever struct {
|
|||
}
|
||||
|
||||
func newConfigRetriever() configRetriever {
|
||||
return configRetriever{common.FindTenantID}
|
||||
return configRetriever{
|
||||
common.FindTenantID,
|
||||
}
|
||||
}
|
||||
|
||||
func (cr configRetriever) FillParameters(c *Config) error {
|
||||
|
@ -22,5 +31,6 @@ func (cr configRetriever) FillParameters(c *Config) error {
|
|||
}
|
||||
c.TenantID = tenantID
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package arm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
@ -143,6 +142,78 @@ func TestConfigShouldRejectCustomImageAndMarketPlace(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestConfigVirtualNetworkNameIsOptional(t *testing.T) {
|
||||
config := map[string]string{
|
||||
"capture_name_prefix": "ignore",
|
||||
"capture_container_name": "ignore",
|
||||
"location": "ignore",
|
||||
"image_url": "ignore",
|
||||
"storage_account": "ignore",
|
||||
"resource_group_name": "ignore",
|
||||
"subscription_id": "ignore",
|
||||
"os_type": constants.Target_Linux,
|
||||
"communicator": "none",
|
||||
"virtual_network_name": "MyVirtualNetwork",
|
||||
}
|
||||
|
||||
c, _, _ := newConfig(config, getPackerConfiguration())
|
||||
if c.VirtualNetworkName != "MyVirtualNetwork" {
|
||||
t.Errorf("Expected Config to set virtual_network_name to MyVirtualNetwork, but got %q", c.VirtualNetworkName)
|
||||
}
|
||||
if c.VirtualNetworkResourceGroupName != "" {
|
||||
t.Errorf("Expected Config to leave virtual_network_resource_group_name to '', but got %q", c.VirtualNetworkResourceGroupName)
|
||||
}
|
||||
if c.VirtualNetworkSubnetName != "" {
|
||||
t.Errorf("Expected Config to leave virtual_network_subnet_name to '', but got %q", c.VirtualNetworkSubnetName)
|
||||
}
|
||||
}
|
||||
|
||||
// The user can pass the value virtual_network_resource_group_name to avoid the lookup of
|
||||
// a virtual network's resource group, or to help with disambiguation. The value should
|
||||
// only be set if virtual_network_name was set.
|
||||
func TestConfigVirtualNetworkResourceGroupNameMustBeSetWithVirtualNetworkName(t *testing.T) {
|
||||
config := map[string]string{
|
||||
"capture_name_prefix": "ignore",
|
||||
"capture_container_name": "ignore",
|
||||
"location": "ignore",
|
||||
"image_url": "ignore",
|
||||
"storage_account": "ignore",
|
||||
"resource_group_name": "ignore",
|
||||
"subscription_id": "ignore",
|
||||
"os_type": constants.Target_Linux,
|
||||
"communicator": "none",
|
||||
"virtual_network_resource_group_name": "MyVirtualNetworkRG",
|
||||
}
|
||||
|
||||
_, _, err := newConfig(config, getPackerConfiguration())
|
||||
if err == nil {
|
||||
t.Error("Expected Config to reject virtual_network_resource_group_name, if virtual_network_name is not set.")
|
||||
}
|
||||
}
|
||||
|
||||
// The user can pass the value virtual_network_subnet_name to avoid the lookup of
|
||||
// a virtual network subnet's name, or to help with disambiguation. The value should
|
||||
// only be set if virtual_network_name was set.
|
||||
func TestConfigVirtualNetworkSubnetNameMustBeSetWithVirtualNetworkName(t *testing.T) {
|
||||
config := map[string]string{
|
||||
"capture_name_prefix": "ignore",
|
||||
"capture_container_name": "ignore",
|
||||
"location": "ignore",
|
||||
"image_url": "ignore",
|
||||
"storage_account": "ignore",
|
||||
"resource_group_name": "ignore",
|
||||
"subscription_id": "ignore",
|
||||
"os_type": constants.Target_Linux,
|
||||
"communicator": "none",
|
||||
"virtual_network_subnet_name": "MyVirtualNetworkRG",
|
||||
}
|
||||
|
||||
_, _, err := newConfig(config, getPackerConfiguration())
|
||||
if err == nil {
|
||||
t.Error("Expected Config to reject virtual_network_subnet_name, if virtual_network_name is not set.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestConfigShouldDefaultToPublicCloud(t *testing.T) {
|
||||
c, _, _ := newConfig(getArmBuilderConfiguration(), getPackerConfiguration())
|
||||
|
||||
|
@ -345,7 +416,7 @@ func TestUseDeviceLoginIsDisabledForWindows(t *testing.T) {
|
|||
|
||||
_, _, err := newConfig(config, getPackerConfiguration())
|
||||
if err == nil {
|
||||
t.Fatalf("Expected test to fail, but it succeeded")
|
||||
t.Fatal("Expected test to fail, but it succeeded")
|
||||
}
|
||||
|
||||
multiError, _ := err.(*packer.MultiError)
|
||||
|
@ -465,7 +536,7 @@ func TestConfigShouldRejectMalformedCaptureContainerName(t *testing.T) {
|
|||
func getArmBuilderConfiguration() map[string]string {
|
||||
m := make(map[string]string)
|
||||
for _, v := range requiredConfigValues {
|
||||
m[v] = fmt.Sprintf("ignored00")
|
||||
m[v] = "ignored00"
|
||||
}
|
||||
|
||||
m["communicator"] = "none"
|
||||
|
@ -476,7 +547,7 @@ func getArmBuilderConfiguration() map[string]string {
|
|||
func getArmBuilderConfigurationWithWindows() map[string]string {
|
||||
m := make(map[string]string)
|
||||
for _, v := range requiredConfigValues {
|
||||
m[v] = fmt.Sprintf("ignored00")
|
||||
m[v] = "ignored00"
|
||||
}
|
||||
|
||||
m["object_id"] = "ignored00"
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
package arm
|
||||
|
||||
// Code to resolve resources that are required by the API. These resources
|
||||
// can most likely be resolved without asking the user, thereby reducing the
|
||||
// amount of configuration they need to provide.
|
||||
//
|
||||
// Resource resolver differs from config retriever because resource resolver
|
||||
// requires a client to communicate with the Azure API. A config retriever is
|
||||
// used to determine values without use of a client.
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type resourceResolver struct {
|
||||
client *AzureClient
|
||||
findVirtualNetworkResourceGroup func(*AzureClient, string) (string, error)
|
||||
findVirtualNetworkSubnet func(*AzureClient, string, string) (string, error)
|
||||
}
|
||||
|
||||
func newResourceResolver(client *AzureClient) *resourceResolver {
|
||||
return &resourceResolver{
|
||||
client: client,
|
||||
findVirtualNetworkResourceGroup: findVirtualNetworkResourceGroup,
|
||||
findVirtualNetworkSubnet: findVirtualNetworkSubnet,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *resourceResolver) Resolve(c *Config) error {
|
||||
if s.shouldResolveResourceGroup(c) {
|
||||
resourceGroupName, err := s.findVirtualNetworkResourceGroup(s.client, c.VirtualNetworkName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
subnetName, err := s.findVirtualNetworkSubnet(s.client, resourceGroupName, c.VirtualNetworkName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.VirtualNetworkResourceGroupName = resourceGroupName
|
||||
c.VirtualNetworkSubnetName = subnetName
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *resourceResolver) shouldResolveResourceGroup(c *Config) bool {
|
||||
return c.VirtualNetworkName != "" && c.VirtualNetworkResourceGroupName == ""
|
||||
}
|
||||
|
||||
func getResourceGroupNameFromId(id string) string {
|
||||
// "/subscriptions/3f499422-dd76-4114-8859-86d526c9deb6/resourceGroups/packer-Resource-Group-yylnwsl30j/providers/...
|
||||
xs := strings.Split(id, "/")
|
||||
return xs[4]
|
||||
}
|
||||
|
||||
func findVirtualNetworkResourceGroup(client *AzureClient, name string) (string, error) {
|
||||
virtualNetworks, err := client.VirtualNetworksClient.ListAll()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
resourceGroupNames := make([]string, 0)
|
||||
|
||||
for _, virtualNetwork := range *virtualNetworks.Value {
|
||||
if strings.EqualFold(name, *virtualNetwork.Name) {
|
||||
rgn := getResourceGroupNameFromId(*virtualNetwork.ID)
|
||||
resourceGroupNames = append(resourceGroupNames, rgn)
|
||||
}
|
||||
}
|
||||
|
||||
if len(resourceGroupNames) == 0 {
|
||||
return "", fmt.Errorf("Cannot find a resource group with a virtual network called %q", name)
|
||||
}
|
||||
|
||||
if len(resourceGroupNames) > 1 {
|
||||
return "", fmt.Errorf("Found multiple resource groups with a virtual network called %q, please use virtual_network_resource_group_name to disambiguate", name)
|
||||
}
|
||||
|
||||
return resourceGroupNames[0], nil
|
||||
}
|
||||
|
||||
func findVirtualNetworkSubnet(client *AzureClient, resourceGroupName string, name string) (string, error) {
|
||||
subnets, err := client.SubnetsClient.List(resourceGroupName, name)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if len(*subnets.Value) == 0 {
|
||||
return "", fmt.Errorf("Cannot find a subnet in the resource group %q associated with the virtual network called %q", resourceGroupName, name)
|
||||
}
|
||||
|
||||
if len(*subnets.Value) > 1 {
|
||||
return "", fmt.Errorf("Found multiple subnets in the resource group %q associated with the virtual network called %q, please use virtual_network_subnet_name to disambiguate", resourceGroupName, name)
|
||||
}
|
||||
|
||||
subnet := (*subnets.Value)[0]
|
||||
return *subnet.Name, nil
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
package arm
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestResourceResolverIgnoresEmptyVirtualNetworkName(t *testing.T) {
|
||||
c, _, _ := newConfig(getArmBuilderConfiguration(), getPackerConfiguration())
|
||||
if c.VirtualNetworkName != "" {
|
||||
t.Fatalf("Expected VirtualNetworkName to be empty by default")
|
||||
}
|
||||
|
||||
sut := newTestResourceResolver()
|
||||
sut.findVirtualNetworkResourceGroup = nil // assert that this is not even called
|
||||
sut.Resolve(c)
|
||||
|
||||
if c.VirtualNetworkName != "" {
|
||||
t.Fatalf("Expected VirtualNetworkName to be empty")
|
||||
}
|
||||
if c.VirtualNetworkResourceGroupName != "" {
|
||||
t.Fatalf("Expected VirtualNetworkResourceGroupName to be empty")
|
||||
}
|
||||
}
|
||||
|
||||
// If the user fully specified the virtual network name and resource group then
|
||||
// there is no need to do a lookup.
|
||||
func TestResourceResolverIgnoresSetVirtualNetwork(t *testing.T) {
|
||||
c, _, _ := newConfig(getArmBuilderConfiguration(), getPackerConfiguration())
|
||||
c.VirtualNetworkName = "--virtual-network-name--"
|
||||
c.VirtualNetworkResourceGroupName = "--virtual-network-resource-group-name--"
|
||||
c.VirtualNetworkSubnetName = "--virtual-network-subnet-name--"
|
||||
|
||||
sut := newTestResourceResolver()
|
||||
sut.findVirtualNetworkResourceGroup = nil // assert that this is not even called
|
||||
sut.findVirtualNetworkSubnet = nil // assert that this is not even called
|
||||
sut.Resolve(c)
|
||||
|
||||
if c.VirtualNetworkName != "--virtual-network-name--" {
|
||||
t.Fatalf("Expected VirtualNetworkName to be --virtual-network-name--")
|
||||
}
|
||||
if c.VirtualNetworkResourceGroupName != "--virtual-network-resource-group-name--" {
|
||||
t.Fatalf("Expected VirtualNetworkResourceGroupName to be --virtual-network-resource-group-name--")
|
||||
}
|
||||
if c.VirtualNetworkSubnetName != "--virtual-network-subnet-name--" {
|
||||
t.Fatalf("Expected VirtualNetworkSubnetName to be --virtual-network-subnet-name--")
|
||||
}
|
||||
}
|
||||
|
||||
// If the user set virtual network name then the code should resolve virtual network
|
||||
// resource group name.
|
||||
func TestResourceResolverSetVirtualNetworkResourceGroupName(t *testing.T) {
|
||||
c, _, _ := newConfig(getArmBuilderConfiguration(), getPackerConfiguration())
|
||||
c.VirtualNetworkName = "--virtual-network-name--"
|
||||
|
||||
sut := newTestResourceResolver()
|
||||
sut.Resolve(c)
|
||||
|
||||
if c.VirtualNetworkResourceGroupName != "findVirtualNetworkResourceGroup is mocked" {
|
||||
t.Fatalf("Expected VirtualNetworkResourceGroupName to be 'findVirtualNetworkResourceGroup is mocked'")
|
||||
}
|
||||
if c.VirtualNetworkSubnetName != "findVirtualNetworkSubnet is mocked" {
|
||||
t.Fatalf("Expected findVirtualNetworkSubnet to be 'findVirtualNetworkSubnet is mocked'")
|
||||
}
|
||||
}
|
||||
|
||||
func newTestResourceResolver() resourceResolver {
|
||||
return resourceResolver{
|
||||
client: nil,
|
||||
findVirtualNetworkResourceGroup: func(*AzureClient, string) (string, error) {
|
||||
return "findVirtualNetworkResourceGroup is mocked", nil
|
||||
},
|
||||
findVirtualNetworkSubnet: func(*AzureClient, string, string) (string, error) {
|
||||
return "findVirtualNetworkSubnet is mocked", nil
|
||||
},
|
||||
}
|
||||
}
|
|
@ -97,19 +97,19 @@ func TestStepCaptureImageShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
|||
var expectedCaptureTemplate = stateBag.Get(constants.ArmCaptureTemplate).(*CaptureTemplate)
|
||||
|
||||
if actualComputeName != expectedComputeName {
|
||||
t.Fatalf("Expected StepCaptureImage to source 'constants.ArmComputeName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected StepCaptureImage to source 'constants.ArmComputeName' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
if actualResourceGroupName != expectedResourceGroupName {
|
||||
t.Fatalf("Expected StepCaptureImage to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected StepCaptureImage to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
if actualVirtualMachineCaptureParameters != expectedVirtualMachineCaptureParameters {
|
||||
t.Fatalf("Expected StepCaptureImage to source 'constants.ArmVirtualMachineCaptureParameters' from the state bag, but it did not.")
|
||||
t.Fatal("Expected StepCaptureImage to source 'constants.ArmVirtualMachineCaptureParameters' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
if actualCaptureTemplate != expectedCaptureTemplate {
|
||||
t.Fatalf("Expected StepCaptureImage to source 'constants.ArmCaptureTemplate' from the state bag, but it did not.")
|
||||
t.Fatal("Expected StepCaptureImage to source 'constants.ArmCaptureTemplate' from the state bag, but it did not.")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,16 +74,16 @@ func TestStepCreateResourceGroupShouldTakeStepArgumentsFromStateBag(t *testing.T
|
|||
var expectedResourceGroupName = stateBag.Get(constants.ArmResourceGroupName).(string)
|
||||
|
||||
if actualResourceGroupName != expectedResourceGroupName {
|
||||
t.Fatalf("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
if actualLocation != expectedLocation {
|
||||
t.Fatalf("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
_, ok := stateBag.GetOk(constants.ArmIsResourceGroupCreated)
|
||||
if !ok {
|
||||
t.Fatalf("Expected the step to add item to stateBag['constants.ArmIsResourceGroupCreated'], but it did not.")
|
||||
t.Fatal("Expected the step to add item to stateBag['constants.ArmIsResourceGroupCreated'], but it did not.")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ func TestStepDeleteResourceGroupShouldDeleteStateBagArmResourceGroupCreated(t *t
|
|||
|
||||
value, ok := stateBag.GetOk(constants.ArmIsResourceGroupCreated)
|
||||
if !ok {
|
||||
t.Fatalf("Expected the resource bag value arm.IsResourceGroupCreated to exist")
|
||||
t.Fatal("Expected the resource bag value arm.IsResourceGroupCreated to exist")
|
||||
}
|
||||
|
||||
if value.(bool) {
|
||||
|
|
|
@ -77,11 +77,11 @@ func TestStepDeployTemplateShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
|||
var expectedResourceGroupName = stateBag.Get(constants.ArmResourceGroupName).(string)
|
||||
|
||||
if actualDeploymentName != expectedDeploymentName {
|
||||
t.Fatalf("Expected StepValidateTemplate to source 'constants.ArmDeploymentName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected StepValidateTemplate to source 'constants.ArmDeploymentName' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
if actualResourceGroupName != expectedResourceGroupName {
|
||||
t.Fatalf("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,10 +77,10 @@ func TestStepGetCertificateShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
|||
var expectedKeyVaultName = stateBag.Get(constants.ArmKeyVaultName).(string)
|
||||
|
||||
if actualKeyVaultName != expectedKeyVaultName {
|
||||
t.Fatalf("Expected StepGetCertificate to source 'constants.ArmKeyVaultName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected StepGetCertificate to source 'constants.ArmKeyVaultName' from the state bag, but it did not.")
|
||||
}
|
||||
if actualSecretName != DefaultSecretName {
|
||||
t.Fatalf("Expected StepGetCertificate to use default value for secret, but it did not.")
|
||||
t.Fatal("Expected StepGetCertificate to use default value for secret, but it did not.")
|
||||
}
|
||||
|
||||
expectedCertificateUrl, ok := stateBag.GetOk(constants.ArmCertificateUrl)
|
||||
|
|
|
@ -11,43 +11,77 @@ import (
|
|||
"github.com/mitchellh/packer/packer"
|
||||
)
|
||||
|
||||
type EndpointType int
|
||||
|
||||
const (
|
||||
PublicEndpoint EndpointType = iota
|
||||
PrivateEndpoint
|
||||
)
|
||||
|
||||
var (
|
||||
EndpointCommunicationText = map[EndpointType]string{
|
||||
PublicEndpoint: "PublicEndpoint",
|
||||
PrivateEndpoint: "PrivateEndpoint",
|
||||
}
|
||||
)
|
||||
|
||||
type StepGetIPAddress struct {
|
||||
client *AzureClient
|
||||
get func(resourceGroupName string, ipAddressName string) (string, error)
|
||||
say func(message string)
|
||||
error func(e error)
|
||||
client *AzureClient
|
||||
endpoint EndpointType
|
||||
get func(resourceGroupName string, ipAddressName string, interfaceName string) (string, error)
|
||||
say func(message string)
|
||||
error func(e error)
|
||||
}
|
||||
|
||||
func NewStepGetIPAddress(client *AzureClient, ui packer.Ui) *StepGetIPAddress {
|
||||
func NewStepGetIPAddress(client *AzureClient, ui packer.Ui, endpoint EndpointType) *StepGetIPAddress {
|
||||
var step = &StepGetIPAddress{
|
||||
client: client,
|
||||
say: func(message string) { ui.Say(message) },
|
||||
error: func(e error) { ui.Error(e.Error()) },
|
||||
client: client,
|
||||
endpoint: endpoint,
|
||||
say: func(message string) { ui.Say(message) },
|
||||
error: func(e error) { ui.Error(e.Error()) },
|
||||
}
|
||||
|
||||
switch endpoint {
|
||||
case PrivateEndpoint:
|
||||
step.get = step.getPrivateIP
|
||||
case PublicEndpoint:
|
||||
step.get = step.getPublicIP
|
||||
}
|
||||
|
||||
step.get = step.getIPAddress
|
||||
return step
|
||||
}
|
||||
|
||||
func (s *StepGetIPAddress) getIPAddress(resourceGroupName string, ipAddressName string) (string, error) {
|
||||
res, err := s.client.PublicIPAddressesClient.Get(resourceGroupName, ipAddressName, "")
|
||||
func (s *StepGetIPAddress) getPrivateIP(resourceGroupName string, ipAddressName string, interfaceName string) (string, error) {
|
||||
resp, err := s.client.InterfacesClient.Get(resourceGroupName, interfaceName, "")
|
||||
if err != nil {
|
||||
return "", nil
|
||||
return "", err
|
||||
}
|
||||
|
||||
return *res.Properties.IPAddress, nil
|
||||
return *(*resp.Properties.IPConfigurations)[0].Properties.PrivateIPAddress, nil
|
||||
}
|
||||
|
||||
func (s *StepGetIPAddress) getPublicIP(resourceGroupName string, ipAddressName string, interfaceName string) (string, error) {
|
||||
resp, err := s.client.PublicIPAddressesClient.Get(resourceGroupName, ipAddressName, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return *resp.Properties.IPAddress, nil
|
||||
}
|
||||
|
||||
func (s *StepGetIPAddress) Run(state multistep.StateBag) multistep.StepAction {
|
||||
s.say("Getting the public IP address ...")
|
||||
s.say("Getting the VM's IP address ...")
|
||||
|
||||
var resourceGroupName = state.Get(constants.ArmResourceGroupName).(string)
|
||||
var ipAddressName = state.Get(constants.ArmPublicIPAddressName).(string)
|
||||
var nicName = state.Get(constants.ArmNicName).(string)
|
||||
|
||||
s.say(fmt.Sprintf(" -> ResourceGroupName : '%s'", resourceGroupName))
|
||||
s.say(fmt.Sprintf(" -> PublicIPAddressName : '%s'", ipAddressName))
|
||||
s.say(fmt.Sprintf(" -> NicName : '%s'", nicName))
|
||||
s.say(fmt.Sprintf(" -> Network Connection : '%s'", EndpointCommunicationText[s.endpoint]))
|
||||
|
||||
address, err := s.get(resourceGroupName, ipAddressName)
|
||||
address, err := s.get(resourceGroupName, ipAddressName, nicName)
|
||||
if err != nil {
|
||||
state.Put(constants.Error, err)
|
||||
s.error(err)
|
||||
|
@ -55,8 +89,8 @@ func (s *StepGetIPAddress) Run(state multistep.StateBag) multistep.StepAction {
|
|||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
s.say(fmt.Sprintf(" -> Public IP : '%s'", address))
|
||||
state.Put(constants.SSHHost, address)
|
||||
s.say(fmt.Sprintf(" -> IP Address : '%s'", address))
|
||||
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
|
|
|
@ -13,9 +13,10 @@ import (
|
|||
|
||||
func TestStepGetIPAddressShouldFailIfGetFails(t *testing.T) {
|
||||
var testSubject = &StepGetIPAddress{
|
||||
get: func(string, string) (string, error) { return "", fmt.Errorf("!! Unit Test FAIL !!") },
|
||||
say: func(message string) {},
|
||||
error: func(e error) {},
|
||||
get: func(string, string, string) (string, error) { return "", fmt.Errorf("!! Unit Test FAIL !!") },
|
||||
endpoint: PublicEndpoint,
|
||||
say: func(message string) {},
|
||||
error: func(e error) {},
|
||||
}
|
||||
|
||||
stateBag := createTestStateBagStepGetIPAddress()
|
||||
|
@ -32,9 +33,10 @@ func TestStepGetIPAddressShouldFailIfGetFails(t *testing.T) {
|
|||
|
||||
func TestStepGetIPAddressShouldPassIfGetPasses(t *testing.T) {
|
||||
var testSubject = &StepGetIPAddress{
|
||||
get: func(string, string) (string, error) { return "", nil },
|
||||
say: func(message string) {},
|
||||
error: func(e error) {},
|
||||
get: func(string, string, string) (string, error) { return "", nil },
|
||||
endpoint: PublicEndpoint,
|
||||
say: func(message string) {},
|
||||
error: func(e error) {},
|
||||
}
|
||||
|
||||
stateBag := createTestStateBagStepGetIPAddress()
|
||||
|
@ -52,16 +54,19 @@ func TestStepGetIPAddressShouldPassIfGetPasses(t *testing.T) {
|
|||
func TestStepGetIPAddressShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
||||
var actualResourceGroupName string
|
||||
var actualIPAddressName string
|
||||
var actualNicName string
|
||||
|
||||
var testSubject = &StepGetIPAddress{
|
||||
get: func(resourceGroupName string, ipAddressName string) (string, error) {
|
||||
get: func(resourceGroupName string, ipAddressName string, nicName string) (string, error) {
|
||||
actualResourceGroupName = resourceGroupName
|
||||
actualIPAddressName = ipAddressName
|
||||
actualNicName = nicName
|
||||
|
||||
return "127.0.0.1", nil
|
||||
},
|
||||
say: func(message string) {},
|
||||
error: func(e error) {},
|
||||
endpoint: PublicEndpoint,
|
||||
say: func(message string) {},
|
||||
error: func(e error) {},
|
||||
}
|
||||
|
||||
stateBag := createTestStateBagStepGetIPAddress()
|
||||
|
@ -73,13 +78,18 @@ func TestStepGetIPAddressShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
|||
|
||||
var expectedResourceGroupName = stateBag.Get(constants.ArmResourceGroupName).(string)
|
||||
var expectedIPAddressName = stateBag.Get(constants.ArmPublicIPAddressName).(string)
|
||||
var expectedNicName = stateBag.Get(constants.ArmNicName).(string)
|
||||
|
||||
if actualIPAddressName != expectedIPAddressName {
|
||||
t.Fatalf("Expected StepGetIPAddress to source 'constants.ArmIPAddressName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected StepGetIPAddress to source 'constants.ArmIPAddressName' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
if actualResourceGroupName != expectedResourceGroupName {
|
||||
t.Fatalf("Expected StepGetIPAddress to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected StepGetIPAddress to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
if actualNicName != expectedNicName {
|
||||
t.Fatalf("Expected StepGetIPAddress to source 'constants.ArmNetworkInterfaceName' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
expectedIPAddress, ok := stateBag.GetOk(constants.SSHHost)
|
||||
|
@ -96,6 +106,7 @@ func createTestStateBagStepGetIPAddress() multistep.StateBag {
|
|||
stateBag := new(multistep.BasicStateBag)
|
||||
|
||||
stateBag.Put(constants.ArmPublicIPAddressName, "Unit Test: PublicIPAddressName")
|
||||
stateBag.Put(constants.ArmNicName, "Unit Test: NicName")
|
||||
stateBag.Put(constants.ArmResourceGroupName, "Unit Test: ResourceGroupName")
|
||||
|
||||
return stateBag
|
||||
|
|
|
@ -82,11 +82,11 @@ func TestStepGetOSDiskShouldTakeValidateArgumentsFromStateBag(t *testing.T) {
|
|||
var expectedResourceGroupName = stateBag.Get(constants.ArmResourceGroupName).(string)
|
||||
|
||||
if actualComputeName != expectedComputeName {
|
||||
t.Fatalf("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
if actualResourceGroupName != expectedResourceGroupName {
|
||||
t.Fatalf("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
expectedOSDiskVhd, ok := stateBag.GetOk(constants.ArmOSDiskVhd)
|
||||
|
|
|
@ -75,11 +75,11 @@ func TestStepPowerOffComputeShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
|||
var expectedResourceGroupName = stateBag.Get(constants.ArmResourceGroupName).(string)
|
||||
|
||||
if actualComputeName != expectedComputeName {
|
||||
t.Fatalf("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
if actualResourceGroupName != expectedResourceGroupName {
|
||||
t.Fatalf("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
func TestProcessStepResultShouldContinueForNonErrors(t *testing.T) {
|
||||
stateBag := new(multistep.BasicStateBag)
|
||||
|
||||
code := processStepResult(nil, func(error) { t.Fatalf("Should not be called!") }, stateBag)
|
||||
code := processStepResult(nil, func(error) { t.Fatal("Should not be called!") }, stateBag)
|
||||
if _, ok := stateBag.GetOk(constants.Error); ok {
|
||||
t.Errorf("Error was nil, but was still in the state bag.")
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ func TestProcessStepResultShouldContinueOnSuccessfulTask(t *testing.T) {
|
|||
Err: nil,
|
||||
}
|
||||
|
||||
code := processInterruptibleResult(result, func(error) { t.Fatalf("Should not be called!") }, stateBag)
|
||||
code := processInterruptibleResult(result, func(error) { t.Fatal("Should not be called!") }, stateBag)
|
||||
if _, ok := stateBag.GetOk(constants.Error); ok {
|
||||
t.Errorf("Error was nil, but was still in the state bag.")
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ func TestProcessStepResultShouldHaltWhenTaskIsCancelled(t *testing.T) {
|
|||
Err: nil,
|
||||
}
|
||||
|
||||
code := processInterruptibleResult(result, func(error) { t.Fatalf("Should not be called!") }, stateBag)
|
||||
code := processInterruptibleResult(result, func(error) { t.Fatal("Should not be called!") }, stateBag)
|
||||
if _, ok := stateBag.GetOk(constants.Error); ok {
|
||||
t.Errorf("Error was nil, but was still in the state bag.")
|
||||
}
|
||||
|
|
|
@ -75,11 +75,11 @@ func TestStepValidateTemplateShouldTakeStepArgumentsFromStateBag(t *testing.T) {
|
|||
var expectedResourceGroupName = stateBag.Get(constants.ArmResourceGroupName).(string)
|
||||
|
||||
if actualDeploymentName != expectedDeploymentName {
|
||||
t.Fatalf("Expected the step to source 'constants.ArmDeploymentName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected the step to source 'constants.ArmDeploymentName' from the state bag, but it did not.")
|
||||
}
|
||||
|
||||
if actualResourceGroupName != expectedResourceGroupName {
|
||||
t.Fatalf("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,13 @@ func GetVirtualMachineDeployment(config *Config) (*resources.Deployment, error)
|
|||
builder.SetMarketPlaceImage(config.ImagePublisher, config.ImageOffer, config.ImageSku, config.ImageVersion)
|
||||
}
|
||||
|
||||
if config.VirtualNetworkName != "" {
|
||||
builder.SetVirtualNetwork(
|
||||
config.VirtualNetworkResourceGroupName,
|
||||
config.VirtualNetworkName,
|
||||
config.VirtualNetworkSubnetName)
|
||||
}
|
||||
|
||||
doc, _ := builder.ToJSON()
|
||||
return createDeploymentParameters(*doc, params)
|
||||
}
|
||||
|
|
|
@ -1,67 +1,67 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"keyVaultName": {
|
||||
"type": "string"
|
||||
},
|
||||
"keyVaultSecretValue": {
|
||||
"type": "securestring"
|
||||
},
|
||||
"objectId": {
|
||||
"type": "string"
|
||||
},
|
||||
"tenantId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[parameters('keyVaultName')]",
|
||||
"properties": {
|
||||
"accessPolicies": [
|
||||
{
|
||||
"objectId": "[parameters('objectId')]",
|
||||
"permissions": {
|
||||
"keys": [
|
||||
"all"
|
||||
],
|
||||
"secrets": [
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"tenantId": "[parameters('tenantId')]"
|
||||
}
|
||||
],
|
||||
"enabledForDeployment": "true",
|
||||
"enabledForTemplateDeployment": "true",
|
||||
"sku": {
|
||||
"family": "A",
|
||||
"name": "standard"
|
||||
},
|
||||
"tenantId": "[parameters('tenantId')]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.KeyVault/vaults/', parameters('keyVaultName'))]"
|
||||
],
|
||||
"name": "[variables('keyVaultSecretName')]",
|
||||
"properties": {
|
||||
"value": "[parameters('keyVaultSecretValue')]"
|
||||
},
|
||||
"type": "secrets"
|
||||
}
|
||||
],
|
||||
"type": "Microsoft.KeyVault/vaults"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"apiVersion": "2015-06-01",
|
||||
"keyVaultSecretName": "packerKeyVaultSecret",
|
||||
"location": "[resourceGroup().location]"
|
||||
}
|
||||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"keyVaultName": {
|
||||
"type": "string"
|
||||
},
|
||||
"keyVaultSecretValue": {
|
||||
"type": "securestring"
|
||||
},
|
||||
"objectId": {
|
||||
"type": "string"
|
||||
},
|
||||
"tenantId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[parameters('keyVaultName')]",
|
||||
"properties": {
|
||||
"accessPolicies": [
|
||||
{
|
||||
"objectId": "[parameters('objectId')]",
|
||||
"permissions": {
|
||||
"keys": [
|
||||
"all"
|
||||
],
|
||||
"secrets": [
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"tenantId": "[parameters('tenantId')]"
|
||||
}
|
||||
],
|
||||
"enabledForDeployment": "true",
|
||||
"enabledForTemplateDeployment": "true",
|
||||
"sku": {
|
||||
"family": "A",
|
||||
"name": "standard"
|
||||
},
|
||||
"tenantId": "[parameters('tenantId')]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.KeyVault/vaults/', parameters('keyVaultName'))]"
|
||||
],
|
||||
"name": "[variables('keyVaultSecretName')]",
|
||||
"properties": {
|
||||
"value": "[parameters('keyVaultSecretValue')]"
|
||||
},
|
||||
"type": "secrets"
|
||||
}
|
||||
],
|
||||
"type": "Microsoft.KeyVault/vaults"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"apiVersion": "2015-06-01",
|
||||
"keyVaultSecretName": "packerKeyVaultSecret",
|
||||
"location": "[resourceGroup().location]"
|
||||
}
|
||||
}
|
|
@ -1,160 +1,161 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"properties": {
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||
},
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
|
||||
},
|
||||
"type": "Microsoft.Network/publicIPAddresses"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetAddressPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/virtualNetworks"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/networkInterfaces"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"linuxConfiguration": {
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"keyData": "",
|
||||
"path": "[variables('sshKeyPath')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"offer": "ImageOffer",
|
||||
"publisher": "ImagePublisher",
|
||||
"sku": "ImageSku",
|
||||
"version": "ImageVersion"
|
||||
},
|
||||
"osDisk": {
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage",
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Microsoft.Compute/virtualMachines"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "packerSubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "packerNetwork",
|
||||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"properties": {
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||
},
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
|
||||
},
|
||||
"type": "Microsoft.Network/publicIPAddresses"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetAddressPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/virtualNetworks"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/networkInterfaces"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"linuxConfiguration": {
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"keyData": "",
|
||||
"path": "[variables('sshKeyPath')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"offer": "ImageOffer",
|
||||
"publisher": "ImagePublisher",
|
||||
"sku": "ImageSku",
|
||||
"version": "ImageVersion"
|
||||
},
|
||||
"osDisk": {
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage",
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Microsoft.Compute/virtualMachines"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "packerSubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "packerNetwork",
|
||||
"virtualNetworkResourceGroup": "[resourceGroup().name]",
|
||||
"vmStorageAccountContainerName": "images",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
"vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
}
|
||||
}
|
|
@ -1,158 +1,159 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"properties": {
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||
},
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
|
||||
},
|
||||
"type": "Microsoft.Network/publicIPAddresses"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetAddressPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/virtualNetworks"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/networkInterfaces"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"linuxConfiguration": {
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"keyData": "",
|
||||
"path": "[variables('sshKeyPath')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"osDisk": {
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage",
|
||||
"image": {
|
||||
"uri": "https://localhost/custom.vhd"
|
||||
},
|
||||
"name": "osdisk",
|
||||
"osType": "Linux",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Microsoft.Compute/virtualMachines"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "packerSubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "packerNetwork",
|
||||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"properties": {
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||
},
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
|
||||
},
|
||||
"type": "Microsoft.Network/publicIPAddresses"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetAddressPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/virtualNetworks"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/networkInterfaces"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"linuxConfiguration": {
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"keyData": "",
|
||||
"path": "[variables('sshKeyPath')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"osDisk": {
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage",
|
||||
"image": {
|
||||
"uri": "https://localhost/custom.vhd"
|
||||
},
|
||||
"name": "osdisk",
|
||||
"osType": "Linux",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Microsoft.Compute/virtualMachines"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "packerSubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "packerNetwork",
|
||||
"virtualNetworkResourceGroup": "[resourceGroup().name]",
|
||||
"vmStorageAccountContainerName": "images",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
"vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/networkInterfaces"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"linuxConfiguration": {
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"keyData": "",
|
||||
"path": "[variables('sshKeyPath')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"osDisk": {
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage",
|
||||
"image": {
|
||||
"uri": "https://localhost/custom.vhd"
|
||||
},
|
||||
"name": "osdisk",
|
||||
"osType": "Linux",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Microsoft.Compute/virtualMachines"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "virtualNetworkSubnetName",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "virtualNetworkName",
|
||||
"virtualNetworkResourceGroup": "virtualNetworkResourceGroupName",
|
||||
"vmStorageAccountContainerName": "images",
|
||||
"vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
}
|
||||
}
|
|
@ -2,11 +2,10 @@ package arm
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/arm/resources/resources"
|
||||
"github.com/mitchellh/packer/builder/azure/common/approvals"
|
||||
"github.com/approvals/go-approval-tests"
|
||||
"github.com/mitchellh/packer/builder/azure/common/constants"
|
||||
"github.com/mitchellh/packer/builder/azure/common/template"
|
||||
)
|
||||
|
@ -110,13 +109,7 @@ func TestVirtualMachineDeployment03(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
bs, err := json.MarshalIndent(deployment.Properties.Template, "", " ")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
reader := strings.NewReader(string(bs))
|
||||
err = approvals.Verify(t, reader)
|
||||
err = approvaltests.VerifyJSONStruct(t, deployment.Properties.Template)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -146,13 +139,39 @@ func TestVirtualMachineDeployment04(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
bs, err := json.MarshalIndent(deployment.Properties.Template, "", " ")
|
||||
err = approvaltests.VerifyJSONStruct(t, deployment.Properties.Template)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVirtualMachineDeployment05(t *testing.T) {
|
||||
config := map[string]string{
|
||||
"capture_name_prefix": "ignore",
|
||||
"capture_container_name": "ignore",
|
||||
"location": "ignore",
|
||||
"image_url": "https://localhost/custom.vhd",
|
||||
"resource_group_name": "ignore",
|
||||
"storage_account": "ignore",
|
||||
"subscription_id": "ignore",
|
||||
"os_type": constants.Target_Linux,
|
||||
"communicator": "none",
|
||||
"virtual_network_name": "virtualNetworkName",
|
||||
"virtual_network_resource_group_name": "virtualNetworkResourceGroupName",
|
||||
"virtual_network_subnet_name": "virtualNetworkSubnetName",
|
||||
}
|
||||
|
||||
c, _, err := newConfig(config, getPackerConfiguration())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
reader := strings.NewReader(string(bs))
|
||||
err = approvals.Verify(t, reader)
|
||||
deployment, err := GetVirtualMachineDeployment(c)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = approvaltests.VerifyJSONStruct(t, deployment.Properties.Template)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -243,13 +262,7 @@ func TestKeyVaultDeployment03(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
bs, err := json.MarshalIndent(deployment.Properties.Template, "", " ")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
reader := strings.NewReader(string(bs))
|
||||
err = approvals.Verify(t, reader)
|
||||
err = approvaltests.VerifyJSONStruct(t, deployment.Properties.Template)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ const (
|
|||
ArmComputeName string = "arm.ComputeName"
|
||||
ArmCertificateUrl string = "arm.CertificateUrl"
|
||||
ArmDeploymentName string = "arm.DeploymentName"
|
||||
ArmNicName string = "arm.NicName"
|
||||
ArmKeyVaultName string = "arm.KeyVaultName"
|
||||
ArmLocation string = "arm.Location"
|
||||
ArmOSDiskVhd string = "arm.OSDiskVhd"
|
||||
|
|
|
@ -39,7 +39,7 @@ var (
|
|||
|
||||
// Authenticate fetches a token from the local file cache or initiates a consent
|
||||
// flow and waits for token to be obtained.
|
||||
func Authenticate(env azure.Environment, subscriptionID, tenantID string, say func(string)) (*azure.ServicePrincipalToken, error) {
|
||||
func Authenticate(env azure.Environment, tenantID string, say func(string)) (*azure.ServicePrincipalToken, error) {
|
||||
clientID, ok := clientIDs[env.Name]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("packer-azure application not set up for Azure environment %q", env.Name)
|
||||
|
@ -81,7 +81,7 @@ func Authenticate(env azure.Environment, subscriptionID, tenantID string, say fu
|
|||
// will go stale every 14 days and we will delete the token file,
|
||||
// re-initiate the device flow.
|
||||
say("Validating the token.")
|
||||
if err := validateToken(env, spt); err != nil {
|
||||
if err = validateToken(env, spt); err != nil {
|
||||
say(fmt.Sprintf("Error: %v", err))
|
||||
say("Stored Azure credentials expired. Please reauthenticate.")
|
||||
say(fmt.Sprintf("Deleting %s", tokenPath))
|
||||
|
@ -96,7 +96,7 @@ func Authenticate(env azure.Environment, subscriptionID, tenantID string, say fu
|
|||
|
||||
// Start an OAuth 2.0 device flow
|
||||
say(fmt.Sprintf("Initiating device flow: %s", tokenPath))
|
||||
spt, err = tokenFromDeviceFlow(say, *oauthCfg, tokenPath, clientID, apiScope)
|
||||
spt, err = tokenFromDeviceFlow(say, *oauthCfg, clientID, apiScope)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ func tokenFromFile(say func(string), oauthCfg azure.OAuthConfig, tokenPath, clie
|
|||
// consent application on a browser and in the meanwhile the authentication
|
||||
// endpoint is polled until user gives consent, denies or the flow times out.
|
||||
// Returned token must be saved.
|
||||
func tokenFromDeviceFlow(say func(string), oauthCfg azure.OAuthConfig, tokenPath, clientID, resource string) (*azure.ServicePrincipalToken, error) {
|
||||
func tokenFromDeviceFlow(say func(string), oauthCfg azure.OAuthConfig, clientID, resource string) (*azure.ServicePrincipalToken, error) {
|
||||
cl := autorest.NewClientWithUserAgent(userAgent)
|
||||
deviceCode, err := azure.InitiateDeviceAuth(&cl, oauthCfg, clientID, resource)
|
||||
if err != nil {
|
||||
|
@ -231,7 +231,6 @@ func FindTenantID(env azure.Environment, subscriptionID string) (string, error)
|
|||
}
|
||||
|
||||
func subscriptionsClient(baseURI string) subscriptions.Client {
|
||||
c := subscriptions.NewClientWithBaseURI(baseURI, "") // used only for unauthenticated requests for generic subs IDs
|
||||
c.Client.UserAgent += userAgent
|
||||
return c
|
||||
client := subscriptions.NewClientWithBaseURI(baseURI)
|
||||
return client
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ func TestInterruptibleTaskShouldImmediatelyEndOnCancel(t *testing.T) {
|
|||
|
||||
result := testSubject.Run()
|
||||
if result.IsCancelled != true {
|
||||
t.Fatalf("Expected the task to be cancelled, but it was not.")
|
||||
t.Fatal("Expected the task to be cancelled, but it was not.")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ func (s *StepCreateCert) Run(state multistep.StateBag) multistep.StepAction {
|
|||
|
||||
err := s.createCert(state)
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Error creating temporary certificate: %s", err)
|
||||
err = fmt.Errorf("Error creating temporary certificate: %s", err)
|
||||
state.Put("error", err)
|
||||
ui.Error(err.Error())
|
||||
return multistep.ActionHalt
|
||||
|
@ -45,11 +45,11 @@ func (s *StepCreateCert) Cleanup(state multistep.StateBag) {}
|
|||
|
||||
func (s *StepCreateCert) createCert(state multistep.StateBag) error {
|
||||
|
||||
log.Printf("createCert: Generating RSA key pair...")
|
||||
log.Println("createCert: Generating RSA key pair...")
|
||||
|
||||
priv, err := rsa.GenerateKey(rand.Reader, 2048)
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Failed to Generate Private Key: %s", err)
|
||||
err = fmt.Errorf("Failed to Generate Private Key: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ func (s *StepCreateCert) createCert(state multistep.StateBag) error {
|
|||
state.Put(constants.PrivateKey, privkey)
|
||||
log.Printf("createCert: Private key:\n%s", privkey)
|
||||
|
||||
log.Printf("createCert: Creating certificate...")
|
||||
log.Println("createCert: Creating certificate...")
|
||||
|
||||
host := fmt.Sprintf("%s.cloudapp.net", s.TmpServiceName)
|
||||
notBefore := time.Now()
|
||||
|
@ -71,7 +71,7 @@ func (s *StepCreateCert) createCert(state multistep.StateBag) error {
|
|||
|
||||
serialNumber, err := rand.Int(rand.Reader, new(big.Int).Lsh(big.NewInt(1), 128))
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Failed to Generate Serial Number: %v", err)
|
||||
err = fmt.Errorf("Failed to Generate Serial Number: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ func (s *StepCreateCert) createCert(state multistep.StateBag) error {
|
|||
|
||||
derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv)
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Failed to Create Certificate: %s", err)
|
||||
err = fmt.Errorf("Failed to Create Certificate: %s", err)
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ func (s *StepGeneralizeOS) Run(state multistep.StateBag) multistep.StepAction {
|
|||
}
|
||||
|
||||
if err := comm.Start(cmd); err != nil {
|
||||
err := fmt.Errorf("Failed executing OS generalization command: %s", err)
|
||||
err = fmt.Errorf("Failed executing OS generalization command: %s", err)
|
||||
state.Put("error", err)
|
||||
ui.Error(err.Error())
|
||||
return multistep.ActionHalt
|
||||
|
|
|
@ -0,0 +1,120 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "--subnet-name--",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "--virtual-network--",
|
||||
"virtualNetworkResourceGroup": "--virtual-network-resource-group--",
|
||||
"vmStorageAccountContainerName": "images",
|
||||
"vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
},
|
||||
"name": "ipconfig"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"linuxConfiguration": {
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"path": "[variables('sshKeyPath')]",
|
||||
"keyData": "--test-ssh-authorized-key--"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"osDisk": {
|
||||
"osType": "Linux",
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
},
|
||||
"image": {
|
||||
"uri": "http://azure/custom.vhd"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -13,8 +13,11 @@ const (
|
|||
jsonPrefix = ""
|
||||
jsonIndent = " "
|
||||
|
||||
resourceVirtualMachine = "Microsoft.Compute/virtualMachines"
|
||||
resourceKeyVaults = "Microsoft.KeyVault/vaults"
|
||||
resourceKeyVaults = "Microsoft.KeyVault/vaults"
|
||||
resourceNetworkInterfaces = "Microsoft.Network/networkInterfaces"
|
||||
resourcePublicIPAddresses = "Microsoft.Network/publicIPAddresses"
|
||||
resourceVirtualMachine = "Microsoft.Compute/virtualMachines"
|
||||
resourceVirtualNetworks = "Microsoft.Network/virtualNetworks"
|
||||
|
||||
variableSshKeyPath = "sshKeyPath"
|
||||
)
|
||||
|
@ -46,7 +49,7 @@ func (s *TemplateBuilder) BuildLinux(sshAuthorizedKey string) error {
|
|||
profile.LinuxConfiguration = &compute.LinuxConfiguration{
|
||||
SSH: &compute.SSHConfiguration{
|
||||
PublicKeys: &[]compute.SSHPublicKey{
|
||||
compute.SSHPublicKey{
|
||||
{
|
||||
Path: to.StringPtr(s.toVariable(variableSshKeyPath)),
|
||||
KeyData: to.StringPtr(sshAuthorizedKey),
|
||||
},
|
||||
|
@ -66,12 +69,12 @@ func (s *TemplateBuilder) BuildWindows(keyVaultName, winRMCertificateUrl string)
|
|||
profile := resource.Properties.OsProfile
|
||||
|
||||
profile.Secrets = &[]compute.VaultSecretGroup{
|
||||
compute.VaultSecretGroup{
|
||||
{
|
||||
SourceVault: &compute.SubResource{
|
||||
ID: to.StringPtr(s.toResourceID(resourceKeyVaults, keyVaultName)),
|
||||
},
|
||||
VaultCertificates: &[]compute.VaultCertificate{
|
||||
compute.VaultCertificate{
|
||||
{
|
||||
CertificateStore: to.StringPtr("My"),
|
||||
CertificateURL: to.StringPtr(winRMCertificateUrl),
|
||||
},
|
||||
|
@ -83,7 +86,7 @@ func (s *TemplateBuilder) BuildWindows(keyVaultName, winRMCertificateUrl string)
|
|||
ProvisionVMAgent: to.BoolPtr(true),
|
||||
WinRM: &compute.WinRMConfiguration{
|
||||
Listeners: &[]compute.WinRMListener{
|
||||
compute.WinRMListener{
|
||||
{
|
||||
Protocol: "https",
|
||||
CertificateURL: to.StringPtr(winRMCertificateUrl),
|
||||
},
|
||||
|
@ -125,6 +128,28 @@ func (s *TemplateBuilder) SetImageUrl(imageUrl string, osType compute.OperatingS
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *TemplateBuilder) SetVirtualNetwork(virtualNetworkResourceGroup, virtualNetworkName, subnetName string) error {
|
||||
s.setVariable("virtualNetworkResourceGroup", virtualNetworkResourceGroup)
|
||||
s.setVariable("virtualNetworkName", virtualNetworkName)
|
||||
s.setVariable("subnetName", subnetName)
|
||||
|
||||
s.deleteResourceByType(resourceVirtualNetworks)
|
||||
s.deleteResourceByType(resourcePublicIPAddresses)
|
||||
resource, err := s.getResourceByType(resourceNetworkInterfaces)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
s.deleteResourceDependency(resource, func(s string) bool {
|
||||
return strings.Contains(s, "Microsoft.Network/virtualNetworks") ||
|
||||
strings.Contains(s, "Microsoft.Network/publicIPAddresses")
|
||||
})
|
||||
|
||||
(*resource.Properties.IPConfigurations)[0].Properties.PublicIPAddress = nil
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *TemplateBuilder) ToJSON() (*string, error) {
|
||||
bs, err := json.MarshalIndent(s.template, jsonPrefix, jsonIndent)
|
||||
|
||||
|
@ -144,6 +169,10 @@ func (s *TemplateBuilder) getResourceByType(t string) (*Resource, error) {
|
|||
return nil, fmt.Errorf("template: could not find a resource of type %s", t)
|
||||
}
|
||||
|
||||
func (s *TemplateBuilder) setVariable(name string, value string) {
|
||||
(*s.template.Variables)[name] = value
|
||||
}
|
||||
|
||||
func (s *TemplateBuilder) toKeyVaultID(name string) string {
|
||||
return s.toResourceID(resourceKeyVaults, name)
|
||||
}
|
||||
|
@ -156,6 +185,31 @@ func (s *TemplateBuilder) toVariable(name string) string {
|
|||
return fmt.Sprintf("[variables('%s')]", name)
|
||||
}
|
||||
|
||||
func (s *TemplateBuilder) deleteResourceByType(resourceType string) {
|
||||
resources := make([]Resource, 0)
|
||||
|
||||
for _, resource := range *s.template.Resources {
|
||||
if *resource.Type == resourceType {
|
||||
continue
|
||||
}
|
||||
resources = append(resources, resource)
|
||||
}
|
||||
|
||||
s.template.Resources = &resources
|
||||
}
|
||||
|
||||
func (s *TemplateBuilder) deleteResourceDependency(resource *Resource, predicate func(string) bool) {
|
||||
deps := make([]string, 0)
|
||||
|
||||
for _, dep := range *resource.DependsOn {
|
||||
if !predicate(dep) {
|
||||
deps = append(deps, dep)
|
||||
}
|
||||
}
|
||||
|
||||
*resource.DependsOn = deps
|
||||
}
|
||||
|
||||
const basicTemplate = `{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
|
@ -194,8 +248,9 @@ const basicTemplate = `{
|
|||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "packerNetwork",
|
||||
"virtualNetworkResourceGroup": "[resourceGroup().name]",
|
||||
"vmStorageAccountContainerName": "images",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
"vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
|
|
|
@ -1,160 +1,161 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "packerSubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "packerNetwork",
|
||||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"properties": {
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||
},
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
|
||||
},
|
||||
"type": "Microsoft.Network/publicIPAddresses"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetAddressPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/virtualNetworks"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/networkInterfaces"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"linuxConfiguration": {
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"keyData": "--test-ssh-authorized-key--",
|
||||
"path": "[variables('sshKeyPath')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"offer": "UbuntuServer",
|
||||
"publisher": "Canonical",
|
||||
"sku": "16.04",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage",
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Microsoft.Compute/virtualMachines"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "packerSubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "packerNetwork",
|
||||
"virtualNetworkResourceGroup": "[resourceGroup().name]",
|
||||
"vmStorageAccountContainerName": "images",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||
},
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetAddressPrefix')]"
|
||||
},
|
||||
"name": "[variables('subnetName')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
},
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
}
|
||||
},
|
||||
"name": "ipconfig"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"linuxConfiguration": {
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"path": "[variables('sshKeyPath')]",
|
||||
"keyData": "--test-ssh-authorized-key--"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "Canonical",
|
||||
"offer": "UbuntuServer",
|
||||
"sku": "16.04",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
"vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
}
|
||||
}
|
|
@ -1,158 +1,159 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "packerSubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "packerNetwork",
|
||||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"properties": {
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||
},
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
|
||||
},
|
||||
"type": "Microsoft.Network/publicIPAddresses"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetAddressPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/virtualNetworks"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/networkInterfaces"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"linuxConfiguration": {
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"keyData": "--test-ssh-authorized-key--",
|
||||
"path": "[variables('sshKeyPath')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"osDisk": {
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage",
|
||||
"image": {
|
||||
"uri": "http://azure/custom.vhd"
|
||||
},
|
||||
"name": "osdisk",
|
||||
"osType": "Linux",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Microsoft.Compute/virtualMachines"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "packerSubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "packerNetwork",
|
||||
"virtualNetworkResourceGroup": "[resourceGroup().name]",
|
||||
"vmStorageAccountContainerName": "images",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||
},
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetAddressPrefix')]"
|
||||
},
|
||||
"name": "[variables('subnetName')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
},
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
}
|
||||
},
|
||||
"name": "ipconfig"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"linuxConfiguration": {
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"path": "[variables('sshKeyPath')]",
|
||||
"keyData": "--test-ssh-authorized-key--"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"osDisk": {
|
||||
"osType": "Linux",
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
},
|
||||
"image": {
|
||||
"uri": "http://azure/custom.vhd"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
"vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/networkInterfaces"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"linuxConfiguration": {
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"keyData": "--test-ssh-authorized-key--",
|
||||
"path": "[variables('sshKeyPath')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"osDisk": {
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage",
|
||||
"image": {
|
||||
"uri": "http://azure/custom.vhd"
|
||||
},
|
||||
"name": "osdisk",
|
||||
"osType": "Linux",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Microsoft.Compute/virtualMachines"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "--subnet-name--",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "--virtual-network--",
|
||||
"virtualNetworkResourceGroup": "--virtual-network-resource-group--",
|
||||
"vmStorageAccountContainerName": "images",
|
||||
"vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
}
|
||||
}
|
|
@ -1,174 +1,175 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "packerSubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "packerNetwork",
|
||||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminPassword": {
|
||||
"type": "string"
|
||||
},
|
||||
"adminUsername": {
|
||||
"type": "string"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"type": "string"
|
||||
},
|
||||
"osDiskName": {
|
||||
"type": "string"
|
||||
},
|
||||
"storageAccountBlobEndpoint": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string"
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"properties": {
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||
},
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
|
||||
},
|
||||
"type": "Microsoft.Network/publicIPAddresses"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetAddressPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/virtualNetworks"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"type": "Microsoft.Network/networkInterfaces"
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"location": "[variables('location')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"secrets": [
|
||||
{
|
||||
"sourceVault": {
|
||||
"id": "[resourceId(resourceGroup().name, 'Microsoft.KeyVault/vaults', '--test-key-vault-name')]"
|
||||
},
|
||||
"vaultCertificates": [
|
||||
{
|
||||
"certificateStore": "My",
|
||||
"certificateUrl": "--test-winrm-certificate-url--"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"windowsConfiguration": {
|
||||
"provisionVMAgent": true,
|
||||
"winRM": {
|
||||
"listeners": [
|
||||
{
|
||||
"certificateUrl": "--test-winrm-certificate-url--",
|
||||
"protocol": "https"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"offer": "WindowsServer",
|
||||
"publisher": "MicrosoftWindowsServer",
|
||||
"sku": "2012-R2-Datacenter",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage",
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "Microsoft.Compute/virtualMachines"
|
||||
}
|
||||
],
|
||||
"variables": {
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[resourceGroup().location]",
|
||||
"nicName": "packerNic",
|
||||
"publicIPAddressName": "packerPublicIP",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
|
||||
"subnetAddressPrefix": "10.0.0.0/24",
|
||||
"subnetName": "packerSubnet",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"virtualNetworkName": "packerNetwork",
|
||||
"virtualNetworkResourceGroup": "[resourceGroup().name]",
|
||||
"vmStorageAccountContainerName": "images",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||
},
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetAddressPrefix')]"
|
||||
},
|
||||
"name": "[variables('subnetName')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[variables('nicName')]",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
},
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
|
||||
}
|
||||
},
|
||||
"name": "ipconfig"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "[variables('apiVersion')]",
|
||||
"name": "[parameters('vmName')]",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[parameters('vmName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]",
|
||||
"windowsConfiguration": {
|
||||
"provisionVMAgent": true,
|
||||
"winRM": {
|
||||
"listeners": [
|
||||
{
|
||||
"protocol": "https",
|
||||
"certificateUrl": "--test-winrm-certificate-url--"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"secrets": [
|
||||
{
|
||||
"sourceVault": {
|
||||
"id": "[resourceId(resourceGroup().name, 'Microsoft.KeyVault/vaults', '--test-key-vault-name')]"
|
||||
},
|
||||
"vaultCertificates": [
|
||||
{
|
||||
"certificateUrl": "--test-winrm-certificate-url--",
|
||||
"certificateStore": "My"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "MicrosoftWindowsServer",
|
||||
"offer": "WindowsServer",
|
||||
"sku": "2012-R2-Datacenter",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat(parameters('storageAccountBlobEndpoint'),variables('vmStorageAccountContainerName'),'/', parameters('osDiskName'),'.vhd')]"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
"vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
|
||||
}
|
||||
}
|
|
@ -1,11 +1,10 @@
|
|||
package template
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Azure/azure-sdk-for-go/arm/compute"
|
||||
"github.com/mitchellh/packer/builder/azure/common/approvals"
|
||||
"github.com/approvals/go-approval-tests"
|
||||
)
|
||||
|
||||
// Ensure that a Linux template is configured as expected.
|
||||
|
@ -31,9 +30,7 @@ func TestBuildLinux00(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
reader := strings.NewReader(*doc)
|
||||
|
||||
err = approvals.Verify(t, reader)
|
||||
err = approvaltests.VerifyJSONBytes(t, []byte(*doc))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -61,9 +58,33 @@ func TestBuildLinux01(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
reader := strings.NewReader(*doc)
|
||||
err = approvaltests.VerifyJSONBytes(t, []byte(*doc))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
err = approvals.Verify(t, reader)
|
||||
// Ensure that a user can specify an existing Virtual Network
|
||||
func TestBuildLinux02(t *testing.T) {
|
||||
testSubject, err := NewTemplateBuilder()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
testSubject.BuildLinux("--test-ssh-authorized-key--")
|
||||
testSubject.SetImageUrl("http://azure/custom.vhd", compute.Linux)
|
||||
|
||||
err = testSubject.SetVirtualNetwork("--virtual-network-resource-group--", "--virtual-network--", "--subnet-name--")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
doc, err := testSubject.ToJSON()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = approvaltests.VerifyJSONBytes(t, []byte(*doc))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -93,9 +114,7 @@ func TestBuildWindows00(t *testing.T) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
|
||||
reader := strings.NewReader(*doc)
|
||||
|
||||
err = approvals.Verify(t, reader)
|
||||
err = approvaltests.VerifyJSONBytes(t, []byte(*doc))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -12,13 +12,13 @@ import (
|
|||
|
||||
func TestTemplateParametersShouldHaveExpectedKeys(t *testing.T) {
|
||||
params := TemplateParameters{
|
||||
AdminUsername: &TemplateParameter{"sentinel"},
|
||||
AdminPassword: &TemplateParameter{"sentinel"},
|
||||
DnsNameForPublicIP: &TemplateParameter{"sentinel"},
|
||||
OSDiskName: &TemplateParameter{"sentinel"},
|
||||
StorageAccountBlobEndpoint: &TemplateParameter{"sentinel"},
|
||||
VMName: &TemplateParameter{"sentinel"},
|
||||
VMSize: &TemplateParameter{"sentinel"},
|
||||
AdminUsername: &TemplateParameter{Value: "sentinel"},
|
||||
AdminPassword: &TemplateParameter{Value: "sentinel"},
|
||||
DnsNameForPublicIP: &TemplateParameter{Value: "sentinel"},
|
||||
OSDiskName: &TemplateParameter{Value: "sentinel"},
|
||||
StorageAccountBlobEndpoint: &TemplateParameter{Value: "sentinel"},
|
||||
VMName: &TemplateParameter{Value: "sentinel"},
|
||||
VMSize: &TemplateParameter{Value: "sentinel"},
|
||||
}
|
||||
|
||||
bs, err := json.Marshal(params)
|
||||
|
@ -53,13 +53,13 @@ func TestTemplateParametersShouldHaveExpectedKeys(t *testing.T) {
|
|||
|
||||
func TestParameterValuesShouldBeSet(t *testing.T) {
|
||||
params := TemplateParameters{
|
||||
AdminUsername: &TemplateParameter{"adminusername00"},
|
||||
AdminPassword: &TemplateParameter{"adminpassword00"},
|
||||
DnsNameForPublicIP: &TemplateParameter{"dnsnameforpublicip00"},
|
||||
OSDiskName: &TemplateParameter{"osdiskname00"},
|
||||
StorageAccountBlobEndpoint: &TemplateParameter{"storageaccountblobendpoint00"},
|
||||
VMName: &TemplateParameter{"vmname00"},
|
||||
VMSize: &TemplateParameter{"vmsize00"},
|
||||
AdminUsername: &TemplateParameter{Value: "adminusername00"},
|
||||
AdminPassword: &TemplateParameter{Value: "adminpassword00"},
|
||||
DnsNameForPublicIP: &TemplateParameter{Value: "dnsnameforpublicip00"},
|
||||
OSDiskName: &TemplateParameter{Value: "osdiskname00"},
|
||||
StorageAccountBlobEndpoint: &TemplateParameter{Value: "storageaccountblobendpoint00"},
|
||||
VMName: &TemplateParameter{Value: "vmname00"},
|
||||
VMSize: &TemplateParameter{Value: "vmsize00"},
|
||||
}
|
||||
|
||||
bs, err := json.Marshal(params)
|
||||
|
@ -89,7 +89,7 @@ func TestParameterValuesShouldBeSet(t *testing.T) {
|
|||
|
||||
func TestEmptyValuesShouldBeOmitted(t *testing.T) {
|
||||
params := TemplateParameters{
|
||||
AdminUsername: &TemplateParameter{"adminusername00"},
|
||||
AdminUsername: &TemplateParameter{Value: "adminusername00"},
|
||||
}
|
||||
|
||||
bs, err := json.Marshal(params)
|
||||
|
|
|
@ -9,47 +9,44 @@ package common
|
|||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"net/url"
|
||||
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
)
|
||||
|
||||
const (
|
||||
AzureVaultApiVersion = "2015-06-01"
|
||||
AzureVaultScope = "https://vault.azure.net"
|
||||
AzureVaultSecretTemplate = "https://{vault-name}.vault.azure.net/secrets/{secret-name}"
|
||||
AzureVaultApiVersion = "2015-06-01"
|
||||
)
|
||||
|
||||
type VaultClient struct {
|
||||
autorest.Client
|
||||
keyVaultEndpoint url.URL
|
||||
}
|
||||
|
||||
func NewVaultClient(keyVaultEndpoint url.URL) VaultClient {
|
||||
return VaultClient{
|
||||
keyVaultEndpoint: keyVaultEndpoint,
|
||||
}
|
||||
}
|
||||
|
||||
type Secret struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Value string `json:"value"`
|
||||
Attributes SecretAttributes `json:"attributes"`
|
||||
}
|
||||
|
||||
type SecretAttributes struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
Created *string `json:"created"`
|
||||
Updated *string `json:"updated"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
func (client *VaultClient) GetSecret(vaultName, secretName string) (*Secret, error) {
|
||||
p := map[string]interface{}{
|
||||
"secret-name": secretName,
|
||||
"secret-name": autorest.Encode("path", secretName),
|
||||
}
|
||||
q := map[string]interface{}{
|
||||
"api-version": AzureVaultApiVersion,
|
||||
}
|
||||
|
||||
secretURL := strings.Replace(AzureVaultSecretTemplate, "{vault-name}", vaultName, -1)
|
||||
|
||||
req, err := autorest.Prepare(&http.Request{},
|
||||
req, err := autorest.Prepare(
|
||||
&http.Request{},
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(secretURL),
|
||||
autorest.WithPathParameters(p),
|
||||
autorest.WithBaseURL(client.getVaultUrl(vaultName)),
|
||||
autorest.WithPathParameters("/secrets/{secret-name}", p),
|
||||
autorest.WithQueryParameters(q))
|
||||
|
||||
if err != nil {
|
||||
|
@ -81,3 +78,7 @@ func (client *VaultClient) GetSecret(vaultName, secretName string) (*Secret, err
|
|||
|
||||
return &secret, nil
|
||||
}
|
||||
|
||||
func (client *VaultClient) getVaultUrl(vaultName string) string {
|
||||
return fmt.Sprintf("%s://%s.%s/", client.keyVaultEndpoint.Scheme, vaultName, client.keyVaultEndpoint.Host)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestVaultClientKeyVaultEndpoint(t *testing.T) {
|
||||
u, _ := url.Parse("https://vault.azure.net")
|
||||
testSubject := NewVaultClient(*u)
|
||||
|
||||
vaultUrl := testSubject.getVaultUrl("my")
|
||||
if vaultUrl != "https://my.vault.azure.net/" {
|
||||
t.Errorf("expected \"https://my.vault.azure.net/\", got %q", vaultUrl)
|
||||
}
|
||||
}
|
||||
|
||||
func TestVaultClientKeyVaultEndpointPreserveScheme(t *testing.T) {
|
||||
u, _ := url.Parse("http://vault.azure.net")
|
||||
testSubject := NewVaultClient(*u)
|
||||
|
||||
vaultUrl := testSubject.getVaultUrl("my")
|
||||
if vaultUrl != "http://my.vault.azure.net/" {
|
||||
t.Errorf("expected \"http://my.vault.azure.net/\", got %q", vaultUrl)
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ func decodeBMPString(bmpString []byte) (string, error) {
|
|||
func TestBMPStringDecode(t *testing.T) {
|
||||
_, err := decodeBMPString([]byte("a"))
|
||||
if err == nil {
|
||||
t.Fatalf("expected decode to fail, but it succeeded")
|
||||
t.Fatal("expected decode to fail, but it succeeded")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -200,7 +200,7 @@ func makeSalt(saltByteCount int) ([]byte, error) {
|
|||
//
|
||||
// derBytes is a DER encoded certificate.
|
||||
// privateKey is an RSA
|
||||
func Encode(derBytes []byte, privateKey interface{}, password string) (pfxBytes []byte, err error) {
|
||||
func Encode(derBytes []byte, privateKey interface{}, password string) ([]byte, error) {
|
||||
secret, err := bmpString(password)
|
||||
if err != nil {
|
||||
return nil, ErrIncorrectPassword
|
||||
|
|
|
@ -25,7 +25,7 @@ func TestPfxRoundTriRsa(t *testing.T) {
|
|||
|
||||
actualPrivateKey, ok := key.(*rsa.PrivateKey)
|
||||
if !ok {
|
||||
t.Fatalf("failed to decode private key")
|
||||
t.Fatal("failed to decode private key")
|
||||
}
|
||||
|
||||
if privateKey.D.Cmp(actualPrivateKey.D) != 0 {
|
||||
|
|
|
@ -28,7 +28,7 @@ var (
|
|||
|
||||
// marshalPKCS8PrivateKey converts a private key to PKCS#8 encoded form.
|
||||
// See http://www.rsa.com/rsalabs/node.asp?id=2130 and RFC5208.
|
||||
func marshalPKCS8PrivateKey(key interface{}) (der []byte, err error) {
|
||||
func marshalPKCS8PrivateKey(key interface{}) ([]byte, error) {
|
||||
pkcs := pkcs8{
|
||||
Version: 0,
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func TestRoundTripPkcs8Rsa(t *testing.T) {
|
|||
}
|
||||
|
||||
if actualPrivateKey.Validate() != nil {
|
||||
t.Fatalf("private key did not validate")
|
||||
t.Fatal("private key did not validate")
|
||||
}
|
||||
|
||||
if actualPrivateKey.N.Cmp(privateKey.N) != 0 {
|
||||
|
|
|
@ -97,6 +97,6 @@ func TestRoundTripPkcs8ShroudedKeyBag(t *testing.T) {
|
|||
|
||||
actualPrivateKey := key.(*rsa.PrivateKey)
|
||||
if actualPrivateKey.D.Cmp(privateKey.D) != 0 {
|
||||
t.Fatalf("failed to round-trip rsa.PrivateKey.D")
|
||||
t.Fatal("failed to round-trip rsa.PrivateKey.D")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
|
||||
// Artifact represents a GCE image as the result of a Packer build.
|
||||
type Artifact struct {
|
||||
imageName string
|
||||
image Image
|
||||
driver Driver
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,8 @@ func (*Artifact) BuilderId() string {
|
|||
|
||||
// Destroy destroys the GCE image represented by the artifact.
|
||||
func (a *Artifact) Destroy() error {
|
||||
log.Printf("Destroying image: %s", a.imageName)
|
||||
errCh := a.driver.DeleteImage(a.imageName)
|
||||
log.Printf("Destroying image: %s", a.image.Name)
|
||||
errCh := a.driver.DeleteImage(a.image.Name)
|
||||
return <-errCh
|
||||
}
|
||||
|
||||
|
@ -30,12 +30,12 @@ func (*Artifact) Files() []string {
|
|||
|
||||
// Id returns the GCE image name.
|
||||
func (a *Artifact) Id() string {
|
||||
return a.imageName
|
||||
return a.image.Name
|
||||
}
|
||||
|
||||
// String returns the string representation of the artifact.
|
||||
func (a *Artifact) String() string {
|
||||
return fmt.Sprintf("A disk image was created: %v", a.imageName)
|
||||
return fmt.Sprintf("A disk image was created: %v", a.image.Name)
|
||||
}
|
||||
|
||||
func (a *Artifact) State(name string) interface{} {
|
||||
|
|
|
@ -67,6 +67,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
SSHConfig: sshConfig,
|
||||
},
|
||||
new(common.StepProvision),
|
||||
new(StepWaitInstanceStartup),
|
||||
new(StepTeardownInstance),
|
||||
new(StepCreateImage),
|
||||
}
|
||||
|
@ -86,14 +87,14 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||
if rawErr, ok := state.GetOk("error"); ok {
|
||||
return nil, rawErr.(error)
|
||||
}
|
||||
if _, ok := state.GetOk("image_name"); !ok {
|
||||
log.Println("Failed to find image_name in state. Bug?")
|
||||
if _, ok := state.GetOk("image"); !ok {
|
||||
log.Println("Failed to find image in state. Bug?")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
artifact := &Artifact{
|
||||
imageName: state.Get("image_name").(string),
|
||||
driver: driver,
|
||||
image: state.Get("image").(Image),
|
||||
driver: driver,
|
||||
}
|
||||
return artifact, nil
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package googlecompute
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
var RetryExhaustedError error = fmt.Errorf("Function never succeeded in Retry")
|
||||
|
||||
// Retry retries a function up to numTries times with exponential backoff.
|
||||
// If numTries == 0, retry indefinitely. If interval == 0, Retry will not delay retrying and there will be
|
||||
// no exponential backoff. If maxInterval == 0, maxInterval is set to +Infinity.
|
||||
// Intervals are in seconds.
|
||||
// Returns an error if initial > max intervals, if retries are exhausted, or if the passed function returns
|
||||
// an error.
|
||||
func Retry(initialInterval float64, maxInterval float64, numTries uint, function func() (bool, error)) error {
|
||||
if maxInterval == 0 {
|
||||
maxInterval = math.Inf(1)
|
||||
} else if initialInterval < 0 || initialInterval > maxInterval {
|
||||
return fmt.Errorf("Invalid retry intervals (negative or initial < max). Initial: %f, Max: %f.", initialInterval, maxInterval)
|
||||
}
|
||||
|
||||
var err error
|
||||
done := false
|
||||
interval := initialInterval
|
||||
for i := uint(0); !done && (numTries == 0 || i < numTries); i++ {
|
||||
done, err = function()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !done {
|
||||
// Retry after delay. Calculate next delay.
|
||||
time.Sleep(time.Duration(interval) * time.Second)
|
||||
interval = math.Min(interval * 2, maxInterval)
|
||||
}
|
||||
}
|
||||
|
||||
if !done {
|
||||
return RetryExhaustedError
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package googlecompute
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRetry(t *testing.T) {
|
||||
numTries := uint(0)
|
||||
// Test that a passing function only gets called once.
|
||||
err := Retry(0, 0, 0, func() (bool, error) {
|
||||
numTries++
|
||||
return true, nil
|
||||
})
|
||||
if numTries != 1 {
|
||||
t.Fatal("Passing function should not have been retried.")
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("Passing function should not have returned a retry error. Error: %s", err)
|
||||
}
|
||||
|
||||
// Test that a failing function gets retried (once in this example).
|
||||
numTries = 0
|
||||
results := []bool{false, true}
|
||||
err = Retry(0, 0, 0, func() (bool, error) {
|
||||
result := results[numTries]
|
||||
numTries++
|
||||
return result, nil
|
||||
})
|
||||
if numTries != 2 {
|
||||
t.Fatalf("Retried function should have been tried twice. Tried %d times.", numTries)
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatalf("Successful retried function should not have returned a retry error. Error: %s", err)
|
||||
}
|
||||
|
||||
// Test that a function error gets returned, and the function does not get called again.
|
||||
numTries = 0
|
||||
funcErr := fmt.Errorf("This function had an error!")
|
||||
err = Retry(0, 0, 0, func() (bool, error) {
|
||||
numTries++
|
||||
return false, funcErr
|
||||
})
|
||||
if numTries != 1 {
|
||||
t.Fatal("Errant function should not have been retried.")
|
||||
}
|
||||
if err != funcErr {
|
||||
t.Fatalf("Errant function did not return the right error %s. Error: %s", funcErr, err)
|
||||
}
|
||||
|
||||
// Test when a function exhausts its retries.
|
||||
numTries = 0
|
||||
expectedTries := uint(3)
|
||||
err = Retry(0, 0, expectedTries, func() (bool, error) {
|
||||
numTries++
|
||||
return false, nil
|
||||
})
|
||||
if numTries != expectedTries {
|
||||
t.Fatalf("Unsuccessul retry function should have been called %d times. Only called %d times.", expectedTries, numTries)
|
||||
}
|
||||
if err != RetryExhaustedError {
|
||||
t.Fatalf("Unsuccessful retry function should have returned a retry exhausted error. Actual error: %s", err)
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ type Config struct {
|
|||
AccountFile string `mapstructure:"account_file"`
|
||||
ProjectId string `mapstructure:"project_id"`
|
||||
|
||||
Address string `mapstructure:"address"`
|
||||
DiskName string `mapstructure:"disk_name"`
|
||||
DiskSizeGb int64 `mapstructure:"disk_size"`
|
||||
DiskType string `mapstructure:"disk_type"`
|
||||
|
@ -36,15 +37,15 @@ type Config struct {
|
|||
MachineType string `mapstructure:"machine_type"`
|
||||
Metadata map[string]string `mapstructure:"metadata"`
|
||||
Network string `mapstructure:"network"`
|
||||
Subnetwork string `mapstructure:"subnetwork"`
|
||||
Address string `mapstructure:"address"`
|
||||
Preemptible bool `mapstructure:"preemptible"`
|
||||
RawStateTimeout string `mapstructure:"state_timeout"`
|
||||
Region string `mapstructure:"region"`
|
||||
SourceImage string `mapstructure:"source_image"`
|
||||
SourceImageProjectId string `mapstructure:"source_image_project_id"`
|
||||
RawStateTimeout string `mapstructure:"state_timeout"`
|
||||
StartupScriptFile string `mapstructure:"startup_script_file"`
|
||||
Subnetwork string `mapstructure:"subnetwork"`
|
||||
Tags []string `mapstructure:"tags"`
|
||||
UseInternalIP bool `mapstructure:"use_internal_ip"`
|
||||
Region string `mapstructure:"region"`
|
||||
Zone string `mapstructure:"zone"`
|
||||
|
||||
account accountFile
|
||||
|
|
|
@ -10,7 +10,7 @@ type Driver interface {
|
|||
|
||||
// CreateImage creates an image from the given disk in Google Compute
|
||||
// Engine.
|
||||
CreateImage(name, description, family, zone, disk string) <-chan error
|
||||
CreateImage(name, description, family, zone, disk string) (<-chan Image, <-chan error)
|
||||
|
||||
// DeleteImage deletes the image with the given name.
|
||||
DeleteImage(name string) <-chan error
|
||||
|
@ -21,12 +21,15 @@ type Driver interface {
|
|||
// DeleteDisk deletes the disk with the given name.
|
||||
DeleteDisk(zone, name string) (<-chan error, error)
|
||||
|
||||
// GetNatIP gets the NAT IP address for the instance.
|
||||
GetNatIP(zone, name string) (string, error)
|
||||
|
||||
// GetInternalIP gets the GCE-internal IP address for the instance.
|
||||
GetInternalIP(zone, name string) (string, error)
|
||||
|
||||
// GetNatIP gets the NAT IP address for the instance.
|
||||
GetNatIP(zone, name string) (string, error)
|
||||
|
||||
// GetSerialPortOutput gets the Serial Port contents for the instance.
|
||||
GetSerialPortOutput(zone, name string) (string, error)
|
||||
|
||||
// RunInstance takes the given config and launches an instance.
|
||||
RunInstance(*InstanceConfig) (<-chan error, error)
|
||||
|
||||
|
@ -37,21 +40,23 @@ type Driver interface {
|
|||
type Image struct {
|
||||
Name string
|
||||
ProjectId string
|
||||
SizeGb int64
|
||||
}
|
||||
|
||||
type InstanceConfig struct {
|
||||
Description string
|
||||
DiskSizeGb int64
|
||||
DiskType string
|
||||
Image Image
|
||||
MachineType string
|
||||
Metadata map[string]string
|
||||
Name string
|
||||
Network string
|
||||
Subnetwork string
|
||||
Address string
|
||||
Preemptible bool
|
||||
Tags []string
|
||||
Region string
|
||||
Zone string
|
||||
Address string
|
||||
Description string
|
||||
DiskSizeGb int64
|
||||
DiskType string
|
||||
Image Image
|
||||
MachineType string
|
||||
Metadata map[string]string
|
||||
Name string
|
||||
Network string
|
||||
Preemptible bool
|
||||
Region string
|
||||
ServiceAccountEmail string
|
||||
Subnetwork string
|
||||
Tags []string
|
||||
Zone string
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"log"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"github.com/mitchellh/packer/version"
|
||||
|
@ -91,7 +90,7 @@ func (d *driverGCE) ImageExists(name string) bool {
|
|||
return err == nil
|
||||
}
|
||||
|
||||
func (d *driverGCE) CreateImage(name, description, family, zone, disk string) <-chan error {
|
||||
func (d *driverGCE) CreateImage(name, description, family, zone, disk string) (<-chan Image, <-chan error) {
|
||||
image := &compute.Image{
|
||||
Description: description,
|
||||
Name: name,
|
||||
|
@ -100,15 +99,32 @@ func (d *driverGCE) CreateImage(name, description, family, zone, disk string) <-
|
|||
SourceType: "RAW",
|
||||
}
|
||||
|
||||
imageCh := make(chan Image, 1)
|
||||
errCh := make(chan error, 1)
|
||||
op, err := d.service.Images.Insert(d.projectId, image).Do()
|
||||
if err != nil {
|
||||
errCh <- err
|
||||
} else {
|
||||
go waitForState(errCh, "DONE", d.refreshGlobalOp(op))
|
||||
go func() {
|
||||
err = waitForState(errCh, "DONE", d.refreshGlobalOp(op))
|
||||
if err != nil {
|
||||
close(imageCh)
|
||||
}
|
||||
image, err = d.getImage(name, d.projectId)
|
||||
if err != nil {
|
||||
close(imageCh)
|
||||
errCh <- err
|
||||
}
|
||||
imageCh <- Image{
|
||||
Name: name,
|
||||
ProjectId: d.projectId,
|
||||
SizeGb: image.DiskSizeGb,
|
||||
}
|
||||
close(imageCh)
|
||||
}()
|
||||
}
|
||||
|
||||
return errCh
|
||||
return imageCh, errCh
|
||||
}
|
||||
|
||||
func (d *driverGCE) DeleteImage(name string) <-chan error {
|
||||
|
@ -181,6 +197,15 @@ func (d *driverGCE) GetInternalIP(zone, name string) (string, error) {
|
|||
return "", nil
|
||||
}
|
||||
|
||||
func (d *driverGCE) GetSerialPortOutput(zone, name string) (string, error) {
|
||||
output, err := d.service.Instances.GetSerialPortOutput(d.projectId, zone, name).Do()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return output.Contents, nil
|
||||
}
|
||||
|
||||
func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
|
||||
// Get the zone
|
||||
d.ui.Message(fmt.Sprintf("Loading zone: %s", c.Zone))
|
||||
|
@ -191,7 +216,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
|
|||
|
||||
// Get the image
|
||||
d.ui.Message(fmt.Sprintf("Loading image: %s in project %s", c.Image.Name, c.Image.ProjectId))
|
||||
image, err := d.getImage(c.Image)
|
||||
image, err := d.getImage(c.Image.Name, c.Image.ProjectId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -294,7 +319,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
|
|||
},
|
||||
ServiceAccounts: []*compute.ServiceAccount{
|
||||
&compute.ServiceAccount{
|
||||
Email: "default",
|
||||
Email: c.ServiceAccountEmail,
|
||||
Scopes: []string{
|
||||
"https://www.googleapis.com/auth/userinfo.email",
|
||||
"https://www.googleapis.com/auth/compute",
|
||||
|
@ -324,17 +349,17 @@ func (d *driverGCE) WaitForInstance(state, zone, name string) <-chan error {
|
|||
return errCh
|
||||
}
|
||||
|
||||
func (d *driverGCE) getImage(img Image) (image *compute.Image, err error) {
|
||||
projects := []string{img.ProjectId, "centos-cloud", "coreos-cloud", "debian-cloud", "google-containers", "opensuse-cloud", "rhel-cloud", "suse-cloud", "ubuntu-os-cloud", "windows-cloud"}
|
||||
func (d *driverGCE) getImage(name, projectId string) (image *compute.Image, err error) {
|
||||
projects := []string{projectId, "centos-cloud", "coreos-cloud", "debian-cloud", "google-containers", "opensuse-cloud", "rhel-cloud", "suse-cloud", "ubuntu-os-cloud", "windows-cloud"}
|
||||
for _, project := range projects {
|
||||
image, err = d.service.Images.Get(project, img.Name).Do()
|
||||
image, err = d.service.Images.Get(project, name).Do()
|
||||
if err == nil && image != nil && image.SelfLink != "" {
|
||||
return
|
||||
}
|
||||
image = nil
|
||||
}
|
||||
|
||||
err = fmt.Errorf("Image %s could not be found in any of these projects: %s", img.Name, projects)
|
||||
err = fmt.Errorf("Image %s could not be found in any of these projects: %s", name, projects)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -396,18 +421,16 @@ type stateRefreshFunc func() (string, error)
|
|||
|
||||
// waitForState will spin in a loop forever waiting for state to
|
||||
// reach a certain target.
|
||||
func waitForState(errCh chan<- error, target string, refresh stateRefreshFunc) {
|
||||
for {
|
||||
func waitForState(errCh chan<- error, target string, refresh stateRefreshFunc) error {
|
||||
err := Retry(2, 2, 0, func() (bool, error) {
|
||||
state, err := refresh()
|
||||
if err != nil {
|
||||
errCh <- err
|
||||
return
|
||||
return false, err
|
||||
} else if state == target {
|
||||
return true, nil
|
||||
}
|
||||
if state == target {
|
||||
errCh <- nil
|
||||
return
|
||||
}
|
||||
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
return false, nil
|
||||
})
|
||||
errCh <- err
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -6,12 +6,15 @@ type DriverMock struct {
|
|||
ImageExistsName string
|
||||
ImageExistsResult bool
|
||||
|
||||
CreateImageName string
|
||||
CreateImageDesc string
|
||||
CreateImageFamily string
|
||||
CreateImageZone string
|
||||
CreateImageDisk string
|
||||
CreateImageErrCh <-chan error
|
||||
CreateImageName string
|
||||
CreateImageDesc string
|
||||
CreateImageFamily string
|
||||
CreateImageZone string
|
||||
CreateImageDisk string
|
||||
CreateImageProjectId string
|
||||
CreateImageSizeGb int64
|
||||
CreateImageErrCh <-chan error
|
||||
CreateImageResultCh <-chan Image
|
||||
|
||||
DeleteImageName string
|
||||
DeleteImageErrCh <-chan error
|
||||
|
@ -35,6 +38,11 @@ type DriverMock struct {
|
|||
GetInternalIPName string
|
||||
GetInternalIPResult string
|
||||
GetInternalIPErr error
|
||||
|
||||
GetSerialPortOutputZone string
|
||||
GetSerialPortOutputName string
|
||||
GetSerialPortOutputResult string
|
||||
GetSerialPortOutputErr error
|
||||
|
||||
RunInstanceConfig *InstanceConfig
|
||||
RunInstanceErrCh <-chan error
|
||||
|
@ -51,21 +59,39 @@ func (d *DriverMock) ImageExists(name string) bool {
|
|||
return d.ImageExistsResult
|
||||
}
|
||||
|
||||
func (d *DriverMock) CreateImage(name, description, family, zone, disk string) <-chan error {
|
||||
func (d *DriverMock) CreateImage(name, description, family, zone, disk string) (<-chan Image, <-chan error) {
|
||||
d.CreateImageName = name
|
||||
d.CreateImageDesc = description
|
||||
d.CreateImageFamily = family
|
||||
d.CreateImageZone = zone
|
||||
d.CreateImageDisk = disk
|
||||
if d.CreateImageSizeGb == 0 {
|
||||
d.CreateImageSizeGb = 10
|
||||
}
|
||||
if d.CreateImageProjectId == "" {
|
||||
d.CreateImageProjectId = "test"
|
||||
}
|
||||
|
||||
resultCh := d.CreateImageErrCh
|
||||
resultCh := d.CreateImageResultCh
|
||||
if resultCh == nil {
|
||||
ch := make(chan error)
|
||||
ch := make(chan Image, 1)
|
||||
ch <- Image{
|
||||
Name: name,
|
||||
ProjectId: d.CreateImageProjectId,
|
||||
SizeGb: d.CreateImageSizeGb,
|
||||
}
|
||||
close(ch)
|
||||
resultCh = ch
|
||||
}
|
||||
|
||||
return resultCh
|
||||
errCh := d.CreateImageErrCh
|
||||
if errCh == nil {
|
||||
ch := make(chan error)
|
||||
close(ch)
|
||||
errCh = ch
|
||||
}
|
||||
|
||||
return resultCh, errCh
|
||||
}
|
||||
|
||||
func (d *DriverMock) DeleteImage(name string) <-chan error {
|
||||
|
@ -121,6 +147,12 @@ func (d *DriverMock) GetInternalIP(zone, name string) (string, error) {
|
|||
return d.GetInternalIPResult, d.GetInternalIPErr
|
||||
}
|
||||
|
||||
func (d *DriverMock) GetSerialPortOutput(zone, name string) (string, error) {
|
||||
d.GetSerialPortOutputZone = zone
|
||||
d.GetSerialPortOutputName = name
|
||||
return d.GetSerialPortOutputResult, d.GetSerialPortOutputErr
|
||||
}
|
||||
|
||||
func (d *DriverMock) RunInstance(c *InstanceConfig) (<-chan error, error) {
|
||||
d.RunInstanceConfig = c
|
||||
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package googlecompute
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const StartupScriptStartLog string = "Packer startup script starting."
|
||||
const StartupScriptDoneLog string = "Packer startup script done."
|
||||
const StartupScriptKey string = "startup-script"
|
||||
const StartupWrappedScriptKey string = "packer-wrapped-startup-script"
|
||||
|
||||
// We have to encode StartupScriptDoneLog because we use it as a sentinel value to indicate
|
||||
// that the user-provided startup script is done. If we pass StartupScriptDoneLog as-is, it
|
||||
// will be printed early in the instance console log (before the startup script even runs;
|
||||
// we print out instance creation metadata which contains this wrapper script).
|
||||
var StartupScriptDoneLogBase64 string = base64.StdEncoding.EncodeToString([]byte(StartupScriptDoneLog))
|
||||
|
||||
var StartupScript string = fmt.Sprintf(`#!/bin/bash
|
||||
echo %s
|
||||
RETVAL=0
|
||||
|
||||
GetMetadata () {
|
||||
echo "$(curl -f -H "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/attributes/$1 2> /dev/null)"
|
||||
}
|
||||
|
||||
STARTUPSCRIPT=$(GetMetadata %s)
|
||||
STARTUPSCRIPTPATH=/packer-wrapped-startup-script
|
||||
if [ -f "/var/log/startupscript.log" ]; then
|
||||
STARTUPSCRIPTLOGPATH=/var/log/startupscript.log
|
||||
else
|
||||
STARTUPSCRIPTLOGPATH=/var/log/daemon.log
|
||||
fi
|
||||
STARTUPSCRIPTLOGDEST=$(GetMetadata startup-script-log-dest)
|
||||
|
||||
if [[ ! -z $STARTUPSCRIPT ]]; then
|
||||
echo "Executing user-provided startup script..."
|
||||
echo "${STARTUPSCRIPT}" > ${STARTUPSCRIPTPATH}
|
||||
chmod +x ${STARTUPSCRIPTPATH}
|
||||
${STARTUPSCRIPTPATH}
|
||||
RETVAL=$?
|
||||
|
||||
if [[ ! -z $STARTUPSCRIPTLOGDEST ]]; then
|
||||
echo "Uploading user-provided startup script log to ${STARTUPSCRIPTLOGDEST}..."
|
||||
gsutil -h "Content-Type:text/plain" cp ${STARTUPSCRIPTLOGPATH} ${STARTUPSCRIPTLOGDEST}
|
||||
fi
|
||||
|
||||
rm ${STARTUPSCRIPTPATH}
|
||||
fi
|
||||
|
||||
echo $(echo %s | base64 --decode)
|
||||
exit $RETVAL
|
||||
`, StartupScriptStartLog, StartupWrappedScriptKey, StartupScriptDoneLogBase64)
|
|
@ -23,7 +23,8 @@ func (s *StepCreateImage) Run(state multistep.StateBag) multistep.StepAction {
|
|||
ui := state.Get("ui").(packer.Ui)
|
||||
|
||||
ui.Say("Creating image...")
|
||||
errCh := driver.CreateImage(config.ImageName, config.ImageDescription, config.ImageFamily, config.Zone, config.DiskName)
|
||||
|
||||
imageCh, errCh := driver.CreateImage(config.ImageName, config.ImageDescription, config.ImageFamily, config.Zone, config.DiskName)
|
||||
var err error
|
||||
select {
|
||||
case err = <-errCh:
|
||||
|
@ -38,7 +39,7 @@ func (s *StepCreateImage) Run(state multistep.StateBag) multistep.StepAction {
|
|||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
state.Put("image_name", config.ImageName)
|
||||
state.Put("image", <-imageCh)
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
|
||||
|
|
|
@ -18,13 +18,35 @@ func TestStepCreateImage(t *testing.T) {
|
|||
|
||||
config := state.Get("config").(*Config)
|
||||
driver := state.Get("driver").(*DriverMock)
|
||||
driver.CreateImageProjectId = "createimage-project"
|
||||
driver.CreateImageSizeGb = 100
|
||||
|
||||
// run the step
|
||||
if action := step.Run(state); action != multistep.ActionContinue {
|
||||
t.Fatalf("bad action: %#v", action)
|
||||
}
|
||||
|
||||
uncastImage, ok := state.GetOk("image")
|
||||
if !ok {
|
||||
t.Fatal("should have image")
|
||||
}
|
||||
image, ok := uncastImage.(Image)
|
||||
if !ok {
|
||||
t.Fatal("image is not an Image")
|
||||
}
|
||||
|
||||
// Verify created Image results.
|
||||
if image.Name != config.ImageName {
|
||||
t.Fatalf("Created image name, %s, does not match config name, %s.", image.Name, config.ImageName)
|
||||
}
|
||||
if driver.CreateImageProjectId != image.ProjectId {
|
||||
t.Fatalf("Created image project ID, %s, does not match driver project ID, %s.", image.ProjectId, driver.CreateImageProjectId)
|
||||
}
|
||||
if driver.CreateImageSizeGb != image.SizeGb {
|
||||
t.Fatalf("Created image size, %d, does not match the expected test value, %d.", image.SizeGb, driver.CreateImageSizeGb)
|
||||
}
|
||||
|
||||
// Verify state
|
||||
// Verify proper args passed to driver.CreateImage.
|
||||
if driver.CreateImageName != config.ImageName {
|
||||
t.Fatalf("bad: %#v", driver.CreateImageName)
|
||||
}
|
||||
|
@ -40,16 +62,6 @@ func TestStepCreateImage(t *testing.T) {
|
|||
if driver.CreateImageDisk != config.DiskName {
|
||||
t.Fatalf("bad: %#v", driver.CreateImageDisk)
|
||||
}
|
||||
|
||||
nameRaw, ok := state.GetOk("image_name")
|
||||
if !ok {
|
||||
t.Fatal("should have name")
|
||||
}
|
||||
if name, ok := nameRaw.(string); !ok {
|
||||
t.Fatal("name is not a string")
|
||||
} else if name != config.ImageName {
|
||||
t.Fatalf("bad name: %s", name)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStepCreateImage_errorOnChannel(t *testing.T) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package googlecompute
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
"github.com/mitchellh/multistep"
|
||||
|
@ -22,23 +23,34 @@ func (config *Config) getImage() Image {
|
|||
return Image{Name: config.SourceImage, ProjectId: project}
|
||||
}
|
||||
|
||||
func (config *Config) getInstanceMetadata(sshPublicKey string) map[string]string {
|
||||
func (config *Config) getInstanceMetadata(sshPublicKey string) (map[string]string, error) {
|
||||
instanceMetadata := make(map[string]string)
|
||||
var err error
|
||||
|
||||
// Copy metadata from config
|
||||
// Copy metadata from config.
|
||||
for k, v := range config.Metadata {
|
||||
instanceMetadata[k] = v
|
||||
}
|
||||
|
||||
// Merge any existing ssh keys with our public key
|
||||
// Merge any existing ssh keys with our public key.
|
||||
sshMetaKey := "sshKeys"
|
||||
sshKeys := fmt.Sprintf("%s:%s", config.Comm.SSHUsername, sshPublicKey)
|
||||
if confSshKeys, exists := instanceMetadata[sshMetaKey]; exists {
|
||||
sshKeys = fmt.Sprintf("%s\n%s", sshKeys, confSshKeys)
|
||||
}
|
||||
instanceMetadata[sshMetaKey] = sshKeys
|
||||
|
||||
// Wrap any startup script with our own startup script.
|
||||
if config.StartupScriptFile != "" {
|
||||
var content []byte
|
||||
content, err = ioutil.ReadFile(config.StartupScriptFile)
|
||||
instanceMetadata[StartupWrappedScriptKey] = string(content)
|
||||
} else if wrappedStartupScript, exists := instanceMetadata[StartupScriptKey]; exists {
|
||||
instanceMetadata[StartupWrappedScriptKey] = wrappedStartupScript
|
||||
}
|
||||
instanceMetadata[StartupScriptKey] = StartupScript
|
||||
|
||||
return instanceMetadata
|
||||
return instanceMetadata, err
|
||||
}
|
||||
|
||||
// Run executes the Packer build step that creates a GCE instance.
|
||||
|
@ -51,21 +63,26 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
|
|||
ui.Say("Creating instance...")
|
||||
name := config.InstanceName
|
||||
|
||||
errCh, err := driver.RunInstance(&InstanceConfig{
|
||||
Description: "New instance created by Packer",
|
||||
DiskSizeGb: config.DiskSizeGb,
|
||||
DiskType: config.DiskType,
|
||||
Image: config.getImage(),
|
||||
MachineType: config.MachineType,
|
||||
Metadata: config.getInstanceMetadata(sshPublicKey),
|
||||
Name: name,
|
||||
Network: config.Network,
|
||||
Subnetwork: config.Subnetwork,
|
||||
Address: config.Address,
|
||||
Preemptible: config.Preemptible,
|
||||
Tags: config.Tags,
|
||||
Region: config.Region,
|
||||
Zone: config.Zone,
|
||||
var errCh <-chan error
|
||||
var err error
|
||||
var metadata map[string]string
|
||||
metadata, err = config.getInstanceMetadata(sshPublicKey)
|
||||
errCh, err = driver.RunInstance(&InstanceConfig{
|
||||
Address: config.Address,
|
||||
Description: "New instance created by Packer",
|
||||
DiskSizeGb: config.DiskSizeGb,
|
||||
DiskType: config.DiskType,
|
||||
Image: config.getImage(),
|
||||
MachineType: config.MachineType,
|
||||
Metadata: metadata,
|
||||
Name: name,
|
||||
Network: config.Network,
|
||||
Preemptible: config.Preemptible,
|
||||
Region: config.Region,
|
||||
ServiceAccountEmail: config.account.ClientEmail,
|
||||
Subnetwork: config.Subnetwork,
|
||||
Tags: config.Tags,
|
||||
Zone: config.Zone,
|
||||
})
|
||||
|
||||
if err == nil {
|
||||
|
|
|
@ -20,6 +20,8 @@ type StepCreateSSHKey struct {
|
|||
}
|
||||
|
||||
// Run executes the Packer build step that generates SSH key pairs.
|
||||
// The key pairs are added to the multistep state as "ssh_private_key" and
|
||||
// "ssh_public_key".
|
||||
func (s *StepCreateSSHKey) Run(state multistep.StateBag) multistep.StepAction {
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ type StepInstanceInfo struct {
|
|||
}
|
||||
|
||||
// Run executes the Packer build step that gathers GCE instance info.
|
||||
// This adds "instance_ip" to the multistep state.
|
||||
func (s *StepInstanceInfo) Run(state multistep.StateBag) multistep.StepAction {
|
||||
config := state.Get("config").(*Config)
|
||||
driver := state.Get("driver").(Driver)
|
||||
|
|
|
@ -27,6 +27,8 @@ func (s *StepTeardownInstance) Run(state multistep.StateBag) multistep.StepActio
|
|||
}
|
||||
|
||||
ui.Say("Deleting instance...")
|
||||
instanceLog, _ := driver.GetSerialPortOutput(config.Zone, name)
|
||||
state.Put("instance_log", instanceLog)
|
||||
errCh, err := driver.DeleteInstance(config.Zone, name)
|
||||
if err == nil {
|
||||
select {
|
||||
|
@ -43,7 +45,6 @@ func (s *StepTeardownInstance) Run(state multistep.StateBag) multistep.StepActio
|
|||
"Error: %s", name, err))
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
|
||||
ui.Message("Instance has been deleted!")
|
||||
state.Put("instance_name", "")
|
||||
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package googlecompute
|
||||
|
||||
import(
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/mitchellh/multistep"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
)
|
||||
|
||||
type StepWaitInstanceStartup int
|
||||
|
||||
// Run reads the instance serial port output and looks for the log entry indicating the startup script finished.
|
||||
func (s *StepWaitInstanceStartup) Run(state multistep.StateBag) multistep.StepAction {
|
||||
config := state.Get("config").(*Config)
|
||||
driver := state.Get("driver").(Driver)
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
instanceName := state.Get("instance_name").(string)
|
||||
|
||||
ui.Say("Waiting for any running startup script to finish...")
|
||||
|
||||
// Keep checking the serial port output to see if the startup script is done.
|
||||
err := Retry(10, 60, 0, func() (bool, error) {
|
||||
output, err := driver.GetSerialPortOutput(config.Zone, instanceName)
|
||||
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Error getting serial port output: %s", err)
|
||||
return false, err
|
||||
}
|
||||
|
||||
done := strings.Contains(output, StartupScriptDoneLog)
|
||||
if !done {
|
||||
ui.Say("Startup script not finished yet. Waiting...")
|
||||
}
|
||||
|
||||
return done, nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
err := fmt.Errorf("Error waiting for startup script to finish: %s", err)
|
||||
state.Put("error", err)
|
||||
ui.Error(err.Error())
|
||||
return multistep.ActionHalt
|
||||
}
|
||||
ui.Say("Startup script, if any, has finished running.")
|
||||
return multistep.ActionContinue
|
||||
}
|
||||
|
||||
// Cleanup.
|
||||
func (s *StepWaitInstanceStartup) Cleanup(state multistep.StateBag) {}
|
|
@ -0,0 +1,38 @@
|
|||
package googlecompute
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/multistep"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestStepWaitInstanceStartup(t *testing.T) {
|
||||
state := testState(t)
|
||||
step := new(StepWaitInstanceStartup)
|
||||
config := state.Get("config").(*Config)
|
||||
driver := state.Get("driver").(*DriverMock)
|
||||
|
||||
testZone := "test-zone"
|
||||
testInstanceName := "test-instance-name"
|
||||
|
||||
config.Zone = testZone
|
||||
state.Put("instance_name", testInstanceName)
|
||||
// The done log triggers step completion.
|
||||
driver.GetSerialPortOutputResult = StartupScriptDoneLog
|
||||
|
||||
// Run the step.
|
||||
if action := step.Run(state); action != multistep.ActionContinue {
|
||||
t.Fatalf("StepWaitInstanceStartup did not return a Continue action: %#v", action)
|
||||
}
|
||||
|
||||
// Check that GetSerialPortOutput was called properly.
|
||||
if driver.GetSerialPortOutputZone != testZone {
|
||||
t.Fatalf(
|
||||
"GetSerialPortOutput wrong zone. Expected: %s, Actual: %s", driver.GetSerialPortOutputZone,
|
||||
testZone)
|
||||
}
|
||||
if driver.GetSerialPortOutputName != testInstanceName {
|
||||
t.Fatalf(
|
||||
"GetSerialPortOutput wrong instance name. Expected: %s, Actual: %s", driver.GetSerialPortOutputName,
|
||||
testInstanceName)
|
||||
}
|
||||
}
|
|
@ -40,6 +40,7 @@ import (
|
|||
dockerpushpostprocessor "github.com/mitchellh/packer/post-processor/docker-push"
|
||||
dockersavepostprocessor "github.com/mitchellh/packer/post-processor/docker-save"
|
||||
dockertagpostprocessor "github.com/mitchellh/packer/post-processor/docker-tag"
|
||||
manifestpostprocessor "github.com/mitchellh/packer/post-processor/manifest"
|
||||
shelllocalpostprocessor "github.com/mitchellh/packer/post-processor/shell-local"
|
||||
vagrantpostprocessor "github.com/mitchellh/packer/post-processor/vagrant"
|
||||
vagrantcloudpostprocessor "github.com/mitchellh/packer/post-processor/vagrant-cloud"
|
||||
|
@ -110,6 +111,7 @@ var PostProcessors = map[string]packer.PostProcessor{
|
|||
"docker-push": new(dockerpushpostprocessor.PostProcessor),
|
||||
"docker-save": new(dockersavepostprocessor.PostProcessor),
|
||||
"docker-tag": new(dockertagpostprocessor.PostProcessor),
|
||||
"manifest": new(manifestpostprocessor.PostProcessor),
|
||||
"shell-local": new(shelllocalpostprocessor.PostProcessor),
|
||||
"vagrant": new(vagrantpostprocessor.PostProcessor),
|
||||
"vagrant-cloud": new(vagrantcloudpostprocessor.PostProcessor),
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"client_secret": "{{env `ARM_CLIENT_SECRET`}}",
|
||||
"resource_group": "{{env `ARM_RESOURCE_GROUP`}}",
|
||||
"storage_account": "{{env `ARM_STORAGE_ACCOUNT`}}",
|
||||
"subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}",
|
||||
"subscription_id": "{{env `ARM_SUBSCRIPTION_ID`}}"
|
||||
},
|
||||
"builders": [{
|
||||
"type": "azure-arm",
|
||||
|
|
7
main.go
7
main.go
|
@ -15,6 +15,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/go-uuid"
|
||||
"github.com/mitchellh/cli"
|
||||
"github.com/mitchellh/packer/command"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
|
@ -36,6 +37,12 @@ func realMain() int {
|
|||
var wrapConfig panicwrap.WrapConfig
|
||||
|
||||
if !panicwrap.Wrapped(&wrapConfig) {
|
||||
// Generate a UUID for this packer run and pass it to the environment.
|
||||
// GenerateUUID always returns a nil error (based on rand.Read) so we'll
|
||||
// just ignore it.
|
||||
UUID, _ := uuid.GenerateUUID()
|
||||
os.Setenv("PACKER_RUN_UUID", UUID)
|
||||
|
||||
// Determine where logs should go in general (requested by the user)
|
||||
logWriter, err := logOutput()
|
||||
if err != nil {
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package manifest
|
||||
|
||||
import "fmt"
|
||||
|
||||
const BuilderId = "packer.post-processor.manifest"
|
||||
|
||||
type Artifact struct {
|
||||
BuildName string `json:"name"`
|
||||
BuilderType string `json:"builder_type"`
|
||||
BuildTime int64 `json:"build_time"`
|
||||
ArtifactFiles []string `json:"files"`
|
||||
ArtifactId string `json:"artifact_id"`
|
||||
PackerRunUUID string `json:"packer_run_uuid"`
|
||||
}
|
||||
|
||||
func (a *Artifact) BuilderId() string {
|
||||
return BuilderId
|
||||
}
|
||||
|
||||
func (a *Artifact) Files() []string {
|
||||
return a.ArtifactFiles
|
||||
}
|
||||
|
||||
func (a *Artifact) Id() string {
|
||||
return a.ArtifactId
|
||||
}
|
||||
|
||||
func (a *Artifact) String() string {
|
||||
return fmt.Sprintf("%s-%s", a.BuildName, a.ArtifactId)
|
||||
}
|
||||
|
||||
func (a *Artifact) State(name string) interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a *Artifact) Destroy() error {
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
package manifest
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/mitchellh/packer/common"
|
||||
"github.com/mitchellh/packer/helper/config"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"github.com/mitchellh/packer/template/interpolate"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
common.PackerConfig `mapstructure:",squash"`
|
||||
|
||||
Filename string `mapstructure:"filename"`
|
||||
|
||||
ctx interpolate.Context
|
||||
}
|
||||
|
||||
type PostProcessor struct {
|
||||
config Config
|
||||
}
|
||||
|
||||
type ManifestFile struct {
|
||||
Builds []Artifact `json:"builds"`
|
||||
LastRunUUID string `json:"last_run_uuid"`
|
||||
}
|
||||
|
||||
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||
err := config.Decode(&p.config, &config.DecodeOpts{
|
||||
Interpolate: true,
|
||||
InterpolateContext: &p.config.ctx,
|
||||
InterpolateFilter: &interpolate.RenderFilter{
|
||||
Exclude: []string{},
|
||||
},
|
||||
}, raws...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if p.config.Filename == "" {
|
||||
p.config.Filename = "packer-manifest.json"
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *PostProcessor) PostProcess(ui packer.Ui, source packer.Artifact) (packer.Artifact, bool, error) {
|
||||
artifact := &Artifact{}
|
||||
|
||||
var err error
|
||||
|
||||
// Create the current artifact.
|
||||
artifact.ArtifactFiles = source.Files()
|
||||
artifact.ArtifactId = source.Id()
|
||||
artifact.BuilderType = p.config.PackerBuilderType
|
||||
artifact.BuildName = p.config.PackerBuildName
|
||||
artifact.BuildTime = time.Now().Unix()
|
||||
// Since each post-processor runs in a different process we need a way to
|
||||
// coordinate between various post-processors in a single packer run. We do
|
||||
// this by setting a UUID per run and tracking this in the manifest file.
|
||||
// When we detect that the UUID in the file is the same, we know that we are
|
||||
// part of the same run and we simply add our data to the list. If the UUID
|
||||
// is different we will check the -force flag and decide whether to truncate
|
||||
// the file before we proceed.
|
||||
artifact.PackerRunUUID = os.Getenv("PACKER_RUN_UUID")
|
||||
|
||||
// Create a lock file with exclusive access. If this fails we will retry
|
||||
// after a delay.
|
||||
lockFilename := p.config.Filename + ".lock"
|
||||
for i := 0; i < 3; i++ {
|
||||
// The file should not be locked for very long so we'll keep this short.
|
||||
time.Sleep((time.Duration(i) * 200 * time.Millisecond))
|
||||
_, err = os.OpenFile(lockFilename, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
log.Printf("Error locking manifest file for reading and writing. Will sleep and retry. %s", err)
|
||||
}
|
||||
defer os.Remove(lockFilename)
|
||||
|
||||
// TODO fix error on first run:
|
||||
// * Post-processor failed: open packer-manifest.json: no such file or directory
|
||||
//
|
||||
// Read the current manifest file from disk
|
||||
contents := []byte{}
|
||||
if contents, err = ioutil.ReadFile(p.config.Filename); err != nil && !os.IsNotExist(err) {
|
||||
return source, true, fmt.Errorf("Unable to open %s for reading: %s", p.config.Filename, err)
|
||||
}
|
||||
|
||||
// Parse the manifest file JSON, if we have one
|
||||
manifestFile := &ManifestFile{}
|
||||
if len(contents) > 0 {
|
||||
if err = json.Unmarshal(contents, manifestFile); err != nil {
|
||||
return source, true, fmt.Errorf("Unable to parse content from %s: %s", p.config.Filename, err)
|
||||
}
|
||||
}
|
||||
|
||||
// If -force is set and we are not on same run, truncate the file. Otherwise
|
||||
// we will continue to add new builds to the existing manifest file.
|
||||
if p.config.PackerForce && os.Getenv("PACKER_RUN_UUID") != manifestFile.LastRunUUID {
|
||||
manifestFile = &ManifestFile{}
|
||||
}
|
||||
|
||||
// Add the current artifact to the manifest file
|
||||
manifestFile.Builds = append(manifestFile.Builds, *artifact)
|
||||
manifestFile.LastRunUUID = os.Getenv("PACKER_RUN_UUID")
|
||||
|
||||
// Write JSON to disk
|
||||
if out, err := json.MarshalIndent(manifestFile, "", " "); err == nil {
|
||||
if err = ioutil.WriteFile(p.config.Filename, out, 0664); err != nil {
|
||||
return source, true, fmt.Errorf("Unable to write %s: %s", p.config.Filename, err)
|
||||
}
|
||||
} else {
|
||||
return source, true, fmt.Errorf("Unable to marshal JSON %s", err)
|
||||
}
|
||||
|
||||
return source, true, nil
|
||||
}
|
|
@ -2,8 +2,9 @@ package vagrantcloud
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"testing"
|
||||
|
||||
"github.com/mitchellh/packer/packer"
|
||||
)
|
||||
|
||||
func testGoodConfig() map[string]interface{} {
|
||||
|
@ -48,7 +49,7 @@ func TestPostProcessor_ImplementsPostProcessor(t *testing.T) {
|
|||
var _ packer.PostProcessor = new(PostProcessor)
|
||||
}
|
||||
|
||||
func TestproviderFromBuilderName(t *testing.T) {
|
||||
func TestProviderFromBuilderName(t *testing.T) {
|
||||
if providerFromBuilderName("foobar") != "foobar" {
|
||||
t.Fatal("should copy unknown provider")
|
||||
}
|
||||
|
|
|
@ -121,8 +121,6 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
|||
ovftool_uri += "/Resources/" + p.config.ResourcePool
|
||||
}
|
||||
|
||||
ui.Message(fmt.Sprintf("Uploading %s to vSphere", source))
|
||||
|
||||
args, err := p.BuildArgs(source, ovftool_uri)
|
||||
if err != nil {
|
||||
ui.Message(fmt.Sprintf("Failed: %s\n", err))
|
||||
|
|
|
@ -252,7 +252,10 @@ func TestAnsibleGetVersion(t *testing.T) {
|
|||
|
||||
var p Provisioner
|
||||
p.config.Command = "ansible-playbook"
|
||||
p.getVersion()
|
||||
err := p.getVersion()
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAnsibleLongMessages(t *testing.T) {
|
||||
|
@ -263,7 +266,10 @@ func TestAnsibleLongMessages(t *testing.T) {
|
|||
var p Provisioner
|
||||
p.config.Command = "ansible-playbook"
|
||||
p.config.PlaybookFile = "./test-fixtures/long-debug-message.yml"
|
||||
p.Prepare()
|
||||
err := p.Prepare()
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
|
||||
comm := &packer.MockCommunicator{}
|
||||
ui := &packer.BasicUi{
|
||||
|
@ -271,5 +277,8 @@ func TestAnsibleLongMessages(t *testing.T) {
|
|||
Writer: new(bytes.Buffer),
|
||||
}
|
||||
|
||||
p.Provision(ui, comm)
|
||||
err = p.Provision(ui, comm)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/mitchellh/packer/common"
|
||||
|
@ -95,12 +96,20 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error {
|
|||
func (p *Provisioner) ProvisionDownload(ui packer.Ui, comm packer.Communicator) error {
|
||||
for _, src := range p.config.Sources {
|
||||
ui.Say(fmt.Sprintf("Downloading %s => %s", src, p.config.Destination))
|
||||
|
||||
if strings.HasSuffix(p.config.Destination, "/") {
|
||||
err := os.MkdirAll(p.config.Destination, os.FileMode(0755))
|
||||
// ensure destination dir exists. p.config.Destination may either be a file or a dir.
|
||||
dir := p.config.Destination
|
||||
// if it doesn't end with a /, set dir as the parent dir
|
||||
if !strings.HasSuffix(p.config.Destination, "/") {
|
||||
dir = filepath.Dir(dir)
|
||||
}
|
||||
if dir != "" {
|
||||
err := os.MkdirAll(dir, os.FileMode(0755))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// if the config.Destination was a dir, download the dir
|
||||
if !strings.HasSuffix(p.config.Destination, "/") {
|
||||
return comm.DownloadDir(src, p.config.Destination, nil)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
package file
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/mitchellh/packer/packer"
|
||||
)
|
||||
|
||||
func testConfig() map[string]interface{} {
|
||||
|
@ -139,3 +141,56 @@ func TestProvisionerProvision_SendsFile(t *testing.T) {
|
|||
t.Fatalf("should upload with source file's data")
|
||||
}
|
||||
}
|
||||
|
||||
func TestProvisionDownloadMkdirAll(t *testing.T) {
|
||||
tests := []struct {
|
||||
path string
|
||||
}{
|
||||
{"dir"},
|
||||
{"dir/"},
|
||||
{"dir/subdir"},
|
||||
{"dir/subdir/"},
|
||||
{"path/to/dir"},
|
||||
{"path/to/dir/"},
|
||||
}
|
||||
tmpDir, err := ioutil.TempDir("", "packer-file")
|
||||
if err != nil {
|
||||
t.Fatalf("error tempdir: %s", err)
|
||||
}
|
||||
defer os.RemoveAll(tmpDir)
|
||||
tf, err := ioutil.TempFile(tmpDir, "packer")
|
||||
if err != nil {
|
||||
t.Fatalf("error tempfile: %s", err)
|
||||
}
|
||||
defer os.Remove(tf.Name())
|
||||
|
||||
config := map[string]interface{}{
|
||||
"source": tf.Name(),
|
||||
}
|
||||
var p Provisioner
|
||||
for _, test := range tests {
|
||||
path := filepath.Join(tmpDir, test.path)
|
||||
config["destination"] = filepath.Join(path, "something")
|
||||
if err := p.Prepare(config); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
ui := &stubUi{}
|
||||
comm := &packer.MockCommunicator{}
|
||||
err = p.ProvisionDownload(ui, comm)
|
||||
if err != nil {
|
||||
t.Fatalf("should successfully provision: %s", err)
|
||||
}
|
||||
|
||||
if !strings.Contains(ui.sayMessages, tf.Name()) {
|
||||
t.Fatalf("should print source filename")
|
||||
}
|
||||
|
||||
if !strings.Contains(ui.sayMessages, "something") {
|
||||
t.Fatalf("should print destination filename")
|
||||
}
|
||||
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
t.Fatalf("stat of download dir should not error: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@
|
|||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
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.
|
||||
|
|
|
@ -14,7 +14,7 @@ package compute
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// AvailabilitySetsClient is the the Compute Management Client.
|
||||
|
@ -70,23 +69,23 @@ func (client AvailabilitySetsClient) CreateOrUpdate(resourceGroupName string, na
|
|||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client AvailabilitySetsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters AvailabilitySet) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": url.QueryEscape(name),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{name}"),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{name}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
|
@ -135,22 +134,21 @@ func (client AvailabilitySetsClient) Delete(resourceGroupName string, availabili
|
|||
// DeletePreparer prepares the Delete request.
|
||||
func (client AvailabilitySetsClient) DeletePreparer(resourceGroupName string, availabilitySetName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"availabilitySetName": url.QueryEscape(availabilitySetName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
|
@ -165,7 +163,7 @@ func (client AvailabilitySetsClient) DeleteResponder(resp *http.Response) (resul
|
|||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
|
@ -198,22 +196,21 @@ func (client AvailabilitySetsClient) Get(resourceGroupName string, availabilityS
|
|||
// GetPreparer prepares the Get request.
|
||||
func (client AvailabilitySetsClient) GetPreparer(resourceGroupName string, availabilitySetName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"availabilitySetName": url.QueryEscape(availabilitySetName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
|
@ -261,21 +258,20 @@ func (client AvailabilitySetsClient) List(resourceGroupName string) (result Avai
|
|||
// ListPreparer prepares the List request.
|
||||
func (client AvailabilitySetsClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
@ -297,32 +293,8 @@ func (client AvailabilitySetsClient) ListResponder(resp *http.Response) (result
|
|||
return
|
||||
}
|
||||
|
||||
// ListNextResults retrieves the next set of results, if any.
|
||||
func (client AvailabilitySetsClient) ListNextResults(lastResults AvailabilitySetListResult) (result AvailabilitySetListResult, err error) {
|
||||
req, err := lastResults.AvailabilitySetListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", nil, "Failure preparing next results request request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure sending next results request request")
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "List", resp, "Failure responding to next results request request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListAvailableSizes lists virtual-machine-sizes available to be used for an
|
||||
// availability set.
|
||||
// ListAvailableSizes lists all available virtual machine sizes that can be
|
||||
// used to create a new virtual machine in an existing availability set.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. availabilitySetName is
|
||||
// the name of the availability set.
|
||||
|
@ -349,22 +321,21 @@ func (client AvailabilitySetsClient) ListAvailableSizes(resourceGroupName string
|
|||
// ListAvailableSizesPreparer prepares the ListAvailableSizes request.
|
||||
func (client AvailabilitySetsClient) ListAvailableSizesPreparer(resourceGroupName string, availabilitySetName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"availabilitySetName": url.QueryEscape(availabilitySetName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"availabilitySetName": autorest.Encode("path", availabilitySetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the
|
||||
|
@ -385,27 +356,3 @@ func (client AvailabilitySetsClient) ListAvailableSizesResponder(resp *http.Resp
|
|||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListAvailableSizesNextResults retrieves the next set of results, if any.
|
||||
func (client AvailabilitySetsClient) ListAvailableSizesNextResults(lastResults VirtualMachineSizeListResult) (result VirtualMachineSizeListResult, err error) {
|
||||
req, err := lastResults.VirtualMachineSizeListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", nil, "Failure preparing next results request request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListAvailableSizesSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure sending next results request request")
|
||||
}
|
||||
|
||||
result, err = client.ListAvailableSizesResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "compute.AvailabilitySetsClient", "ListAvailableSizes", resp, "Failure responding to next results request request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Package compute implements the Azure ARM Compute service API version
|
||||
// 2015-06-15.
|
||||
// 2016-03-30.
|
||||
//
|
||||
// The Compute Management Client.
|
||||
package compute
|
||||
|
@ -18,7 +18,7 @@ package compute
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -28,7 +28,7 @@ import (
|
|||
|
||||
const (
|
||||
// APIVersion is the version of the Compute
|
||||
APIVersion = "2015-06-15"
|
||||
APIVersion = "2016-03-30"
|
||||
|
||||
// DefaultBaseURI is the default URI used for the service Compute
|
||||
DefaultBaseURI = "https://management.azure.com"
|
||||
|
@ -38,6 +38,7 @@ const (
|
|||
type ManagementClient struct {
|
||||
autorest.Client
|
||||
BaseURI string
|
||||
APIVersion string
|
||||
SubscriptionID string
|
||||
}
|
||||
|
||||
|
@ -51,6 +52,7 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
|
|||
return ManagementClient{
|
||||
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||
BaseURI: baseURI,
|
||||
APIVersion: APIVersion,
|
||||
SubscriptionID: subscriptionID,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ package compute
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -58,6 +58,14 @@ const (
|
|||
FromImage DiskCreateOptionTypes = "fromImage"
|
||||
)
|
||||
|
||||
// InstanceViewTypes enumerates the values for instance view types.
|
||||
type InstanceViewTypes string
|
||||
|
||||
const (
|
||||
// InstanceView specifies the instance view state for instance view types.
|
||||
InstanceView InstanceViewTypes = "instanceView"
|
||||
)
|
||||
|
||||
// OperatingSystemTypes enumerates the values for operating system types.
|
||||
type OperatingSystemTypes string
|
||||
|
||||
|
@ -68,36 +76,6 @@ const (
|
|||
Windows OperatingSystemTypes = "Windows"
|
||||
)
|
||||
|
||||
// OperationStatus enumerates the values for operation status.
|
||||
type OperationStatus string
|
||||
|
||||
const (
|
||||
// Failed specifies the failed state for operation status.
|
||||
Failed OperationStatus = "Failed"
|
||||
// InProgress specifies the in progress state for operation status.
|
||||
InProgress OperationStatus = "InProgress"
|
||||
// Succeeded specifies the succeeded state for operation status.
|
||||
Succeeded OperationStatus = "Succeeded"
|
||||
)
|
||||
|
||||
// OperationStatusEnum enumerates the values for operation status enum.
|
||||
type OperationStatusEnum string
|
||||
|
||||
const (
|
||||
// OperationStatusEnumFailed specifies the operation status enum failed
|
||||
// state for operation status enum.
|
||||
OperationStatusEnumFailed OperationStatusEnum = "Failed"
|
||||
// OperationStatusEnumInProgress specifies the operation status enum in
|
||||
// progress state for operation status enum.
|
||||
OperationStatusEnumInProgress OperationStatusEnum = "InProgress"
|
||||
// OperationStatusEnumPreempted specifies the operation status enum
|
||||
// preempted state for operation status enum.
|
||||
OperationStatusEnumPreempted OperationStatusEnum = "Preempted"
|
||||
// OperationStatusEnumSucceeded specifies the operation status enum
|
||||
// succeeded state for operation status enum.
|
||||
OperationStatusEnumSucceeded OperationStatusEnum = "Succeeded"
|
||||
)
|
||||
|
||||
// PassNames enumerates the values for pass names.
|
||||
type PassNames string
|
||||
|
||||
|
@ -149,14 +127,6 @@ const (
|
|||
Manual UpgradeMode = "Manual"
|
||||
)
|
||||
|
||||
// UsageUnit enumerates the values for usage unit.
|
||||
type UsageUnit string
|
||||
|
||||
const (
|
||||
// Count specifies the count state for usage unit.
|
||||
Count UsageUnit = "Count"
|
||||
)
|
||||
|
||||
// VirtualMachineScaleSetSkuScaleType enumerates the values for virtual
|
||||
// machine scale set sku scale type.
|
||||
type VirtualMachineScaleSetSkuScaleType string
|
||||
|
@ -250,6 +220,9 @@ const (
|
|||
// StandardD14V2 specifies the standard d14v2 state for virtual machine
|
||||
// size types.
|
||||
StandardD14V2 VirtualMachineSizeTypes = "Standard_D14_v2"
|
||||
// StandardD15V2 specifies the standard d15v2 state for virtual machine
|
||||
// size types.
|
||||
StandardD15V2 VirtualMachineSizeTypes = "Standard_D15_v2"
|
||||
// StandardD1V2 specifies the standard d1v2 state for virtual machine size
|
||||
// types.
|
||||
StandardD1V2 VirtualMachineSizeTypes = "Standard_D1_v2"
|
||||
|
@ -280,24 +253,54 @@ const (
|
|||
// StandardDS11 specifies the standard ds11 state for virtual machine size
|
||||
// types.
|
||||
StandardDS11 VirtualMachineSizeTypes = "Standard_DS11"
|
||||
// StandardDS11V2 specifies the standard ds11v2 state for virtual machine
|
||||
// size types.
|
||||
StandardDS11V2 VirtualMachineSizeTypes = "Standard_DS11_v2"
|
||||
// StandardDS12 specifies the standard ds12 state for virtual machine size
|
||||
// types.
|
||||
StandardDS12 VirtualMachineSizeTypes = "Standard_DS12"
|
||||
// StandardDS12V2 specifies the standard ds12v2 state for virtual machine
|
||||
// size types.
|
||||
StandardDS12V2 VirtualMachineSizeTypes = "Standard_DS12_v2"
|
||||
// StandardDS13 specifies the standard ds13 state for virtual machine size
|
||||
// types.
|
||||
StandardDS13 VirtualMachineSizeTypes = "Standard_DS13"
|
||||
// StandardDS13V2 specifies the standard ds13v2 state for virtual machine
|
||||
// size types.
|
||||
StandardDS13V2 VirtualMachineSizeTypes = "Standard_DS13_v2"
|
||||
// StandardDS14 specifies the standard ds14 state for virtual machine size
|
||||
// types.
|
||||
StandardDS14 VirtualMachineSizeTypes = "Standard_DS14"
|
||||
// StandardDS14V2 specifies the standard ds14v2 state for virtual machine
|
||||
// size types.
|
||||
StandardDS14V2 VirtualMachineSizeTypes = "Standard_DS14_v2"
|
||||
// StandardDS15V2 specifies the standard ds15v2 state for virtual machine
|
||||
// size types.
|
||||
StandardDS15V2 VirtualMachineSizeTypes = "Standard_DS15_v2"
|
||||
// StandardDS1V2 specifies the standard ds1v2 state for virtual machine
|
||||
// size types.
|
||||
StandardDS1V2 VirtualMachineSizeTypes = "Standard_DS1_v2"
|
||||
// StandardDS2 specifies the standard ds2 state for virtual machine size
|
||||
// types.
|
||||
StandardDS2 VirtualMachineSizeTypes = "Standard_DS2"
|
||||
// StandardDS2V2 specifies the standard ds2v2 state for virtual machine
|
||||
// size types.
|
||||
StandardDS2V2 VirtualMachineSizeTypes = "Standard_DS2_v2"
|
||||
// StandardDS3 specifies the standard ds3 state for virtual machine size
|
||||
// types.
|
||||
StandardDS3 VirtualMachineSizeTypes = "Standard_DS3"
|
||||
// StandardDS3V2 specifies the standard ds3v2 state for virtual machine
|
||||
// size types.
|
||||
StandardDS3V2 VirtualMachineSizeTypes = "Standard_DS3_v2"
|
||||
// StandardDS4 specifies the standard ds4 state for virtual machine size
|
||||
// types.
|
||||
StandardDS4 VirtualMachineSizeTypes = "Standard_DS4"
|
||||
// StandardDS4V2 specifies the standard ds4v2 state for virtual machine
|
||||
// size types.
|
||||
StandardDS4V2 VirtualMachineSizeTypes = "Standard_DS4_v2"
|
||||
// StandardDS5V2 specifies the standard ds5v2 state for virtual machine
|
||||
// size types.
|
||||
StandardDS5V2 VirtualMachineSizeTypes = "Standard_DS5_v2"
|
||||
// StandardG1 specifies the standard g1 state for virtual machine size
|
||||
// types.
|
||||
StandardG1 VirtualMachineSizeTypes = "Standard_G1"
|
||||
|
@ -330,10 +333,10 @@ const (
|
|||
StandardGS5 VirtualMachineSizeTypes = "Standard_GS5"
|
||||
)
|
||||
|
||||
// AdditionalUnattendContent is gets or sets additional XML formatted
|
||||
// information that can be included in the Unattend.xml file, which is used
|
||||
// by Windows Setup. Contents are defined by setting name, component name,
|
||||
// and the pass in which the content is a applied.
|
||||
// AdditionalUnattendContent is additional XML formatted information that can
|
||||
// be included in the Unattend.xml file, which is used by Windows Setup.
|
||||
// Contents are defined by setting name, component name, and the pass in
|
||||
// which the content is a applied.
|
||||
type AdditionalUnattendContent struct {
|
||||
PassName PassNames `json:"passName,omitempty"`
|
||||
ComponentName ComponentNames `json:"componentName,omitempty"`
|
||||
|
@ -377,19 +380,6 @@ type AvailabilitySet struct {
|
|||
type AvailabilitySetListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]AvailabilitySet `json:"value,omitempty"`
|
||||
NextLink *string `json:",omitempty"`
|
||||
}
|
||||
|
||||
// AvailabilitySetListResultPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client AvailabilitySetListResult) AvailabilitySetListResultPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// AvailabilitySetProperties is the instance view of a resource.
|
||||
|
@ -429,15 +419,6 @@ type DataDiskImage struct {
|
|||
Lun *int32 `json:"lun,omitempty"`
|
||||
}
|
||||
|
||||
// DeleteOperationResult is the compute long running operation response.
|
||||
type DeleteOperationResult struct {
|
||||
OperationID *string `json:"operationId,omitempty"`
|
||||
Status OperationStatus `json:"status,omitempty"`
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
Error *APIError `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// DiagnosticsProfile is describes a diagnostics profile.
|
||||
type DiagnosticsProfile struct {
|
||||
BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"`
|
||||
|
@ -447,6 +428,7 @@ type DiagnosticsProfile struct {
|
|||
type DiskEncryptionSettings struct {
|
||||
DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"`
|
||||
KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"`
|
||||
Enabled *bool `json:"enabled,omitempty"`
|
||||
}
|
||||
|
||||
// DiskInstanceView is the instance view of the disk.
|
||||
|
@ -505,7 +487,7 @@ type LinuxConfiguration struct {
|
|||
type ListUsagesResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]Usage `json:"value,omitempty"`
|
||||
NextLink *string `json:",omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// ListUsagesResultPreparer prepares a request to retrieve the next set of results. It returns
|
||||
|
@ -520,6 +502,12 @@ func (client ListUsagesResult) ListUsagesResultPreparer() (*http.Request, error)
|
|||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// ListVirtualMachineExtensionImage is
|
||||
type ListVirtualMachineExtensionImage struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]VirtualMachineExtensionImage `json:"value,omitempty"`
|
||||
}
|
||||
|
||||
// ListVirtualMachineImageResource is
|
||||
type ListVirtualMachineImageResource struct {
|
||||
autorest.Response `json:"-"`
|
||||
|
@ -532,17 +520,6 @@ type LongRunningOperationProperties struct {
|
|||
Output *map[string]interface{} `json:"output,omitempty"`
|
||||
}
|
||||
|
||||
// LongRunningOperationResult is the Compute service response for long-running
|
||||
// operations.
|
||||
type LongRunningOperationResult struct {
|
||||
OperationID *string `json:"operationId,omitempty"`
|
||||
Status OperationStatusEnum `json:"status,omitempty"`
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
Properties *LongRunningOperationProperties `json:"properties,omitempty"`
|
||||
Error *APIError `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// NetworkInterfaceReference is describes a network interface reference.
|
||||
type NetworkInterfaceReference struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
|
@ -651,7 +628,7 @@ type UpgradePolicy struct {
|
|||
|
||||
// Usage is describes Compute Resource Usage.
|
||||
type Usage struct {
|
||||
Unit UsageUnit `json:"unit,omitempty"`
|
||||
Unit *string `json:"unit,omitempty"`
|
||||
CurrentValue *int32 `json:"currentValue,omitempty"`
|
||||
Limit *int64 `json:"limit,omitempty"`
|
||||
Name *UsageName `json:"name,omitempty"`
|
||||
|
@ -746,10 +723,11 @@ type VirtualMachineExtensionHandlerInstanceView struct {
|
|||
type VirtualMachineExtensionImage struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Properties *VirtualMachineExtensionImageProperties `json:"properties,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Location *string `json:"location,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
Properties *VirtualMachineExtensionImageProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// VirtualMachineExtensionImageProperties is describes the properties of a
|
||||
|
@ -775,6 +753,7 @@ type VirtualMachineExtensionInstanceView struct {
|
|||
// VirtualMachineExtensionProperties is describes the properties of a Virtual
|
||||
// Machine Extension.
|
||||
type VirtualMachineExtensionProperties struct {
|
||||
ForceUpdateTag *string `json:"forceUpdateTag,omitempty"`
|
||||
Publisher *string `json:"publisher,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"`
|
||||
|
@ -789,10 +768,10 @@ type VirtualMachineExtensionProperties struct {
|
|||
type VirtualMachineImage struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Properties *VirtualMachineImageProperties `json:"properties,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Location *string `json:"location,omitempty"`
|
||||
Tags *map[string]*string `json:"tags,omitempty"`
|
||||
Properties *VirtualMachineImageProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// VirtualMachineImageProperties is describes the properties of a Virtual
|
||||
|
@ -852,6 +831,8 @@ type VirtualMachineProperties struct {
|
|||
AvailabilitySet *SubResource `json:"availabilitySet,omitempty"`
|
||||
ProvisioningState *string `json:"provisioningState,omitempty"`
|
||||
InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"`
|
||||
LicenseType *string `json:"licenseType,omitempty"`
|
||||
VMID *string `json:"vmId,omitempty"`
|
||||
}
|
||||
|
||||
// VirtualMachineScaleSet is describes a Virtual Machine Scale Set.
|
||||
|
@ -918,8 +899,10 @@ type VirtualMachineScaleSetIPConfiguration struct {
|
|||
// VirtualMachineScaleSetIPConfigurationProperties is describes a virtual
|
||||
// machine scale set network profile's IP configuration properties.
|
||||
type VirtualMachineScaleSetIPConfigurationProperties struct {
|
||||
Subnet *APIEntityReference `json:"subnet,omitempty"`
|
||||
LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"`
|
||||
Subnet *APIEntityReference `json:"subnet,omitempty"`
|
||||
ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"`
|
||||
LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"`
|
||||
LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"`
|
||||
}
|
||||
|
||||
// VirtualMachineScaleSetListResult is the List Virtual Machine operation
|
||||
|
@ -927,7 +910,7 @@ type VirtualMachineScaleSetIPConfigurationProperties struct {
|
|||
type VirtualMachineScaleSetListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]VirtualMachineScaleSet `json:"value,omitempty"`
|
||||
NextLink *string `json:",omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// VirtualMachineScaleSetListResultPreparer prepares a request to retrieve the next set of results. It returns
|
||||
|
@ -947,7 +930,7 @@ func (client VirtualMachineScaleSetListResult) VirtualMachineScaleSetListResultP
|
|||
type VirtualMachineScaleSetListSkusResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]VirtualMachineScaleSetSku `json:"value,omitempty"`
|
||||
NextLink *string `json:",omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// VirtualMachineScaleSetListSkusResultPreparer prepares a request to retrieve the next set of results. It returns
|
||||
|
@ -1032,6 +1015,7 @@ type VirtualMachineScaleSetProperties struct {
|
|||
UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"`
|
||||
VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"`
|
||||
ProvisioningState *string `json:"provisioningState,omitempty"`
|
||||
OverProvision *bool `json:"overProvision,omitempty"`
|
||||
}
|
||||
|
||||
// VirtualMachineScaleSetSku is describes an available virtual machine scale
|
||||
|
@ -1111,7 +1095,7 @@ type VirtualMachineScaleSetVMInstanceView struct {
|
|||
type VirtualMachineScaleSetVMListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]VirtualMachineScaleSetVM `json:"value,omitempty"`
|
||||
NextLink *string `json:",omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// VirtualMachineScaleSetVMListResultPreparer prepares a request to retrieve the next set of results. It returns
|
||||
|
@ -1147,6 +1131,7 @@ type VirtualMachineScaleSetVMProperties struct {
|
|||
DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"`
|
||||
AvailabilitySet *SubResource `json:"availabilitySet,omitempty"`
|
||||
ProvisioningState *string `json:"provisioningState,omitempty"`
|
||||
LicenseType *string `json:"licenseType,omitempty"`
|
||||
}
|
||||
|
||||
// VirtualMachineSize is describes the properties of a VM size.
|
||||
|
@ -1163,19 +1148,6 @@ type VirtualMachineSize struct {
|
|||
type VirtualMachineSizeListResult struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]VirtualMachineSize `json:"value,omitempty"`
|
||||
NextLink *string `json:",omitempty"`
|
||||
}
|
||||
|
||||
// VirtualMachineSizeListResultPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client VirtualMachineSizeListResult) VirtualMachineSizeListResultPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// VirtualMachineStatusCodeCount is the status code and count of the virtual
|
||||
|
|
|
@ -14,7 +14,7 @@ package compute
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// UsageOperationsClient is the the Compute Management Client.
|
||||
|
@ -68,21 +67,20 @@ func (client UsageOperationsClient) List(location string) (result ListUsagesResu
|
|||
// ListPreparer prepares the List request.
|
||||
func (client UsageOperationsClient) ListPreparer(location string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"location": url.QueryEscape(location),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"location": autorest.Encode("path", location),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
|
|
@ -14,7 +14,7 @@ package compute
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -23,9 +23,9 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
major = "2"
|
||||
major = "3"
|
||||
minor = "1"
|
||||
patch = "1"
|
||||
patch = "0"
|
||||
// Always begin a "tag" with a dash (as per http://semver.org)
|
||||
tag = "-beta"
|
||||
semVerFormat = "%s.%s.%s%s"
|
||||
|
@ -34,7 +34,7 @@ const (
|
|||
|
||||
// UserAgent returns the UserAgent string to use when sending http.Requests.
|
||||
func UserAgent() string {
|
||||
return fmt.Sprintf(userAgentFormat, Version(), "compute", "2015-06-15")
|
||||
return fmt.Sprintf(userAgentFormat, Version(), "compute", "2016-03-30")
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
|
|
74
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensionimages.go
generated
vendored
74
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensionimages.go
generated
vendored
|
@ -14,7 +14,7 @@ package compute
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// VirtualMachineExtensionImagesClient is the the Compute Management Client.
|
||||
|
@ -67,24 +66,23 @@ func (client VirtualMachineExtensionImagesClient) Get(location string, publisher
|
|||
// GetPreparer prepares the Get request.
|
||||
func (client VirtualMachineExtensionImagesClient) GetPreparer(location string, publisherName string, typeParameter string, version string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"location": url.QueryEscape(location),
|
||||
"publisherName": url.QueryEscape(publisherName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"type": url.QueryEscape(typeParameter),
|
||||
"version": url.QueryEscape(version),
|
||||
"location": autorest.Encode("path", location),
|
||||
"publisherName": autorest.Encode("path", publisherName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"type": autorest.Encode("path", typeParameter),
|
||||
"version": autorest.Encode("path", version),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
|
@ -108,7 +106,7 @@ func (client VirtualMachineExtensionImagesClient) GetResponder(resp *http.Respon
|
|||
|
||||
// ListTypes gets a list of virtual machine extension image types.
|
||||
//
|
||||
func (client VirtualMachineExtensionImagesClient) ListTypes(location string, publisherName string) (result ListVirtualMachineImageResource, err error) {
|
||||
func (client VirtualMachineExtensionImagesClient) ListTypes(location string, publisherName string) (result ListVirtualMachineExtensionImage, err error) {
|
||||
req, err := client.ListTypesPreparer(location, publisherName)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListTypes", nil, "Failure preparing request")
|
||||
|
@ -131,22 +129,21 @@ func (client VirtualMachineExtensionImagesClient) ListTypes(location string, pub
|
|||
// ListTypesPreparer prepares the ListTypes request.
|
||||
func (client VirtualMachineExtensionImagesClient) ListTypesPreparer(location string, publisherName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"location": url.QueryEscape(location),
|
||||
"publisherName": url.QueryEscape(publisherName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"location": autorest.Encode("path", location),
|
||||
"publisherName": autorest.Encode("path", publisherName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListTypesSender sends the ListTypes request. The method will close the
|
||||
|
@ -157,7 +154,7 @@ func (client VirtualMachineExtensionImagesClient) ListTypesSender(req *http.Requ
|
|||
|
||||
// ListTypesResponder handles the response to the ListTypes request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
|
||||
func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
|
@ -171,8 +168,8 @@ func (client VirtualMachineExtensionImagesClient) ListTypesResponder(resp *http.
|
|||
// ListVersions gets a list of virtual machine extension image versions.
|
||||
//
|
||||
// filter is the filter to apply on the operation.
|
||||
func (client VirtualMachineExtensionImagesClient) ListVersions(location string, publisherName string, typeParameter string, filter string, top *int32, orderBy string) (result ListVirtualMachineImageResource, err error) {
|
||||
req, err := client.ListVersionsPreparer(location, publisherName, typeParameter, filter, top, orderBy)
|
||||
func (client VirtualMachineExtensionImagesClient) ListVersions(location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (result ListVirtualMachineExtensionImage, err error) {
|
||||
req, err := client.ListVersionsPreparer(location, publisherName, typeParameter, filter, top, orderby)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineExtensionImagesClient", "ListVersions", nil, "Failure preparing request")
|
||||
}
|
||||
|
@ -192,34 +189,33 @@ func (client VirtualMachineExtensionImagesClient) ListVersions(location string,
|
|||
}
|
||||
|
||||
// ListVersionsPreparer prepares the ListVersions request.
|
||||
func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(location string, publisherName string, typeParameter string, filter string, top *int32, orderBy string) (*http.Request, error) {
|
||||
func (client VirtualMachineExtensionImagesClient) ListVersionsPreparer(location string, publisherName string, typeParameter string, filter string, top *int32, orderby string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"location": url.QueryEscape(location),
|
||||
"publisherName": url.QueryEscape(publisherName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"type": url.QueryEscape(typeParameter),
|
||||
"location": autorest.Encode("path", location),
|
||||
"publisherName": autorest.Encode("path", publisherName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"type": autorest.Encode("path", typeParameter),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
if len(filter) > 0 {
|
||||
queryParameters["$filter"] = filter
|
||||
queryParameters["$filter"] = autorest.Encode("query", filter)
|
||||
}
|
||||
if top != nil {
|
||||
queryParameters["$top"] = top
|
||||
queryParameters["$top"] = autorest.Encode("query", *top)
|
||||
}
|
||||
if len(orderBy) > 0 {
|
||||
queryParameters["$orderBy"] = orderBy
|
||||
if len(orderby) > 0 {
|
||||
queryParameters["$orderby"] = autorest.Encode("query", orderby)
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListVersionsSender sends the ListVersions request. The method will close the
|
||||
|
@ -230,7 +226,7 @@ func (client VirtualMachineExtensionImagesClient) ListVersionsSender(req *http.R
|
|||
|
||||
// ListVersionsResponder handles the response to the ListVersions request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VirtualMachineExtensionImagesClient) ListVersionsResponder(resp *http.Response) (result ListVirtualMachineImageResource, err error) {
|
||||
func (client VirtualMachineExtensionImagesClient) ListVersionsResponder(resp *http.Response) (result ListVirtualMachineExtensionImage, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
|
|
59
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensions.go
generated
vendored
59
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachineextensions.go
generated
vendored
|
@ -14,7 +14,7 @@ package compute
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// VirtualMachineExtensionsClient is the the Compute Management Client.
|
||||
|
@ -75,24 +74,24 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdate(resourceGroupName st
|
|||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client VirtualMachineExtensionsClient) CreateOrUpdatePreparer(resourceGroupName string, vmName string, vmExtensionName string, extensionParameters VirtualMachineExtension, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmExtensionName": url.QueryEscape(vmExtensionName),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmExtensionName": autorest.Encode("path", vmExtensionName),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
||||
autorest.WithJSON(extensionParameters),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
|
@ -109,7 +108,7 @@ func (client VirtualMachineExtensionsClient) CreateOrUpdateResponder(resp *http.
|
|||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
|
@ -146,23 +145,22 @@ func (client VirtualMachineExtensionsClient) Delete(resourceGroupName string, vm
|
|||
// DeletePreparer prepares the Delete request.
|
||||
func (client VirtualMachineExtensionsClient) DeletePreparer(resourceGroupName string, vmName string, vmExtensionName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmExtensionName": url.QueryEscape(vmExtensionName),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmExtensionName": autorest.Encode("path", vmExtensionName),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
|
@ -179,7 +177,7 @@ func (client VirtualMachineExtensionsClient) DeleteResponder(resp *http.Response
|
|||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusNoContent, http.StatusOK),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
|
@ -214,26 +212,25 @@ func (client VirtualMachineExtensionsClient) Get(resourceGroupName string, vmNam
|
|||
// GetPreparer prepares the Get request.
|
||||
func (client VirtualMachineExtensionsClient) GetPreparer(resourceGroupName string, vmName string, vmExtensionName string, expand string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmExtensionName": url.QueryEscape(vmExtensionName),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmExtensionName": autorest.Encode("path", vmExtensionName),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
if len(expand) > 0 {
|
||||
queryParameters["$expand"] = expand
|
||||
queryParameters["$expand"] = autorest.Encode("query", expand)
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
|
|
|
@ -14,7 +14,7 @@ package compute
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// VirtualMachineImagesClient is the the Compute Management Client.
|
||||
|
@ -67,25 +66,24 @@ func (client VirtualMachineImagesClient) Get(location string, publisherName stri
|
|||
// GetPreparer prepares the Get request.
|
||||
func (client VirtualMachineImagesClient) GetPreparer(location string, publisherName string, offer string, skus string, version string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"location": url.QueryEscape(location),
|
||||
"offer": url.QueryEscape(offer),
|
||||
"publisherName": url.QueryEscape(publisherName),
|
||||
"skus": url.QueryEscape(skus),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"version": url.QueryEscape(version),
|
||||
"location": autorest.Encode("path", location),
|
||||
"offer": autorest.Encode("path", offer),
|
||||
"publisherName": autorest.Encode("path", publisherName),
|
||||
"skus": autorest.Encode("path", skus),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"version": autorest.Encode("path", version),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
|
@ -133,33 +131,32 @@ func (client VirtualMachineImagesClient) List(location string, publisherName str
|
|||
// ListPreparer prepares the List request.
|
||||
func (client VirtualMachineImagesClient) ListPreparer(location string, publisherName string, offer string, skus string, filter string, top *int32, orderby string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"location": url.QueryEscape(location),
|
||||
"offer": url.QueryEscape(offer),
|
||||
"publisherName": url.QueryEscape(publisherName),
|
||||
"skus": url.QueryEscape(skus),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"location": autorest.Encode("path", location),
|
||||
"offer": autorest.Encode("path", offer),
|
||||
"publisherName": autorest.Encode("path", publisherName),
|
||||
"skus": autorest.Encode("path", skus),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
if len(filter) > 0 {
|
||||
queryParameters["$filter"] = filter
|
||||
queryParameters["$filter"] = autorest.Encode("query", filter)
|
||||
}
|
||||
if top != nil {
|
||||
queryParameters["$top"] = top
|
||||
queryParameters["$top"] = autorest.Encode("query", *top)
|
||||
}
|
||||
if len(orderby) > 0 {
|
||||
queryParameters["$orderby"] = orderby
|
||||
queryParameters["$orderby"] = autorest.Encode("query", orderby)
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
@ -206,22 +203,21 @@ func (client VirtualMachineImagesClient) ListOffers(location string, publisherNa
|
|||
// ListOffersPreparer prepares the ListOffers request.
|
||||
func (client VirtualMachineImagesClient) ListOffersPreparer(location string, publisherName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"location": url.QueryEscape(location),
|
||||
"publisherName": url.QueryEscape(publisherName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"location": autorest.Encode("path", location),
|
||||
"publisherName": autorest.Encode("path", publisherName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListOffersSender sends the ListOffers request. The method will close the
|
||||
|
@ -268,21 +264,20 @@ func (client VirtualMachineImagesClient) ListPublishers(location string) (result
|
|||
// ListPublishersPreparer prepares the ListPublishers request.
|
||||
func (client VirtualMachineImagesClient) ListPublishersPreparer(location string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"location": url.QueryEscape(location),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"location": autorest.Encode("path", location),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListPublishersSender sends the ListPublishers request. The method will close the
|
||||
|
@ -329,23 +324,22 @@ func (client VirtualMachineImagesClient) ListSkus(location string, publisherName
|
|||
// ListSkusPreparer prepares the ListSkus request.
|
||||
func (client VirtualMachineImagesClient) ListSkusPreparer(location string, publisherName string, offer string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"location": url.QueryEscape(location),
|
||||
"offer": url.QueryEscape(offer),
|
||||
"publisherName": url.QueryEscape(publisherName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"location": autorest.Encode("path", location),
|
||||
"offer": autorest.Encode("path", offer),
|
||||
"publisherName": autorest.Encode("path", publisherName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSkusSender sends the ListSkus request. The method will close the
|
||||
|
|
|
@ -14,7 +14,7 @@ package compute
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// VirtualMachinesClient is the the Compute Management Client.
|
||||
|
@ -42,9 +41,9 @@ func NewVirtualMachinesClientWithBaseURI(baseURI string, subscriptionID string)
|
|||
return VirtualMachinesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Capture captures the VM by copying VirtualHardDisks of the VM and outputs a
|
||||
// template that can be used to create similar VMs. This method may poll for
|
||||
// completion. Polling can be canceled by passing the cancel channel
|
||||
// Capture captures the VM by copying virtual hard disks of the VM and outputs
|
||||
// a template that can be used to create similar VMs. 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.
|
||||
//
|
||||
|
@ -74,23 +73,23 @@ func (client VirtualMachinesClient) Capture(resourceGroupName string, vmName str
|
|||
// CapturePreparer prepares the Capture request.
|
||||
func (client VirtualMachinesClient) CapturePreparer(resourceGroupName string, vmName string, parameters VirtualMachineCaptureParameters, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture"),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CaptureSender sends the Capture request. The method will close the
|
||||
|
@ -144,23 +143,23 @@ func (client VirtualMachinesClient) CreateOrUpdate(resourceGroupName string, vmN
|
|||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client VirtualMachinesClient) CreateOrUpdatePreparer(resourceGroupName string, vmName string, parameters VirtualMachine, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
|
@ -177,7 +176,7 @@ func (client VirtualMachinesClient) CreateOrUpdateResponder(resp *http.Response)
|
|||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
|
@ -214,22 +213,21 @@ func (client VirtualMachinesClient) Deallocate(resourceGroupName string, vmName
|
|||
// DeallocatePreparer prepares the Deallocate request.
|
||||
func (client VirtualMachinesClient) DeallocatePreparer(resourceGroupName string, vmName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeallocateSender sends the Deallocate request. The method will close the
|
||||
|
@ -282,22 +280,21 @@ func (client VirtualMachinesClient) Delete(resourceGroupName string, vmName stri
|
|||
// DeletePreparer prepares the Delete request.
|
||||
func (client VirtualMachinesClient) DeletePreparer(resourceGroupName string, vmName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
|
@ -347,22 +344,21 @@ func (client VirtualMachinesClient) Generalize(resourceGroupName string, vmName
|
|||
// GeneralizePreparer prepares the Generalize request.
|
||||
func (client VirtualMachinesClient) GeneralizePreparer(resourceGroupName string, vmName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GeneralizeSender sends the Generalize request. The method will close the
|
||||
|
@ -387,8 +383,8 @@ func (client VirtualMachinesClient) GeneralizeResponder(resp *http.Response) (re
|
|||
//
|
||||
// resourceGroupName is the name of the resource group. vmName is the name of
|
||||
// the virtual machine. expand is the expand expression to apply on the
|
||||
// operation.
|
||||
func (client VirtualMachinesClient) Get(resourceGroupName string, vmName string, expand string) (result VirtualMachine, err error) {
|
||||
// operation. Possible values include: 'instanceView'
|
||||
func (client VirtualMachinesClient) Get(resourceGroupName string, vmName string, expand InstanceViewTypes) (result VirtualMachine, err error) {
|
||||
req, err := client.GetPreparer(resourceGroupName, vmName, expand)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Get", nil, "Failure preparing request")
|
||||
|
@ -409,27 +405,26 @@ func (client VirtualMachinesClient) Get(resourceGroupName string, vmName string,
|
|||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client VirtualMachinesClient) GetPreparer(resourceGroupName string, vmName string, expand string) (*http.Request, error) {
|
||||
func (client VirtualMachinesClient) GetPreparer(resourceGroupName string, vmName string, expand InstanceViewTypes) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
if len(expand) > 0 {
|
||||
queryParameters["$expand"] = expand
|
||||
if len(string(expand)) > 0 {
|
||||
queryParameters["$expand"] = autorest.Encode("query", expand)
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
|
@ -477,21 +472,20 @@ func (client VirtualMachinesClient) List(resourceGroupName string) (result Virtu
|
|||
// ListPreparer prepares the List request.
|
||||
func (client VirtualMachinesClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
@ -563,20 +557,19 @@ func (client VirtualMachinesClient) ListAll() (result VirtualMachineListResult,
|
|||
// ListAllPreparer prepares the ListAll request.
|
||||
func (client VirtualMachinesClient) ListAllPreparer() (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListAllSender sends the ListAll request. The method will close the
|
||||
|
@ -622,8 +615,8 @@ func (client VirtualMachinesClient) ListAllNextResults(lastResults VirtualMachin
|
|||
return
|
||||
}
|
||||
|
||||
// ListAvailableSizes lists virtual-machine-sizes available to be used for a
|
||||
// virtual machine.
|
||||
// ListAvailableSizes lists all available virtual machine sizes it can be
|
||||
// resized to for a virtual machine.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. vmName is the name of
|
||||
// the virtual machine.
|
||||
|
@ -650,22 +643,21 @@ func (client VirtualMachinesClient) ListAvailableSizes(resourceGroupName string,
|
|||
// ListAvailableSizesPreparer prepares the ListAvailableSizes request.
|
||||
func (client VirtualMachinesClient) ListAvailableSizesPreparer(resourceGroupName string, vmName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListAvailableSizesSender sends the ListAvailableSizes request. The method will close the
|
||||
|
@ -687,30 +679,6 @@ func (client VirtualMachinesClient) ListAvailableSizesResponder(resp *http.Respo
|
|||
return
|
||||
}
|
||||
|
||||
// ListAvailableSizesNextResults retrieves the next set of results, if any.
|
||||
func (client VirtualMachinesClient) ListAvailableSizesNextResults(lastResults VirtualMachineSizeListResult) (result VirtualMachineSizeListResult, err error) {
|
||||
req, err := lastResults.VirtualMachineSizeListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", nil, "Failure preparing next results request request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListAvailableSizesSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure sending next results request request")
|
||||
}
|
||||
|
||||
result, err = client.ListAvailableSizesResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "ListAvailableSizes", resp, "Failure responding to next results request request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// PowerOff the operation to power off (stop) a virtual machine. 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
|
||||
|
@ -741,22 +709,21 @@ func (client VirtualMachinesClient) PowerOff(resourceGroupName string, vmName st
|
|||
// PowerOffPreparer prepares the PowerOff request.
|
||||
func (client VirtualMachinesClient) PowerOffPreparer(resourceGroupName string, vmName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// PowerOffSender sends the PowerOff request. The method will close the
|
||||
|
@ -779,6 +746,73 @@ func (client VirtualMachinesClient) PowerOffResponder(resp *http.Response) (resu
|
|||
return
|
||||
}
|
||||
|
||||
// Redeploy the operation to redeploy a virtual machine. 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. vmName is the name of
|
||||
// the virtual machine.
|
||||
func (client VirtualMachinesClient) Redeploy(resourceGroupName string, vmName string, cancel <-chan struct{}) (result autorest.Response, err error) {
|
||||
req, err := client.RedeployPreparer(resourceGroupName, vmName, cancel)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.RedeploySender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.RedeployResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachinesClient", "Redeploy", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// RedeployPreparer prepares the Redeploy request.
|
||||
func (client VirtualMachinesClient) RedeployPreparer(resourceGroupName string, vmName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// RedeploySender sends the Redeploy request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VirtualMachinesClient) RedeploySender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// RedeployResponder handles the response to the Redeploy request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VirtualMachinesClient) RedeployResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Restart the operation to restart a virtual machine. 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
|
||||
|
@ -809,22 +843,21 @@ func (client VirtualMachinesClient) Restart(resourceGroupName string, vmName str
|
|||
// RestartPreparer prepares the Restart request.
|
||||
func (client VirtualMachinesClient) RestartPreparer(resourceGroupName string, vmName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// RestartSender sends the Restart request. The method will close the
|
||||
|
@ -877,22 +910,21 @@ func (client VirtualMachinesClient) Start(resourceGroupName string, vmName strin
|
|||
// StartPreparer prepares the Start request.
|
||||
func (client VirtualMachinesClient) StartPreparer(resourceGroupName string, vmName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmName": url.QueryEscape(vmName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmName": autorest.Encode("path", vmName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// StartSender sends the Start request. The method will close the
|
||||
|
|
319
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesets.go
generated
vendored
319
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesets.go
generated
vendored
|
@ -14,7 +14,7 @@ package compute
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// VirtualMachineScaleSetsClient is the the Compute Management Client.
|
||||
|
@ -42,10 +41,11 @@ func NewVirtualMachineScaleSetsClientWithBaseURI(baseURI string, subscriptionID
|
|||
return VirtualMachineScaleSetsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate the operation to create or update a virtual machine scale
|
||||
// set. 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.
|
||||
// CreateOrUpdate allows you to create or update a virtual machine scale set
|
||||
// by providing parameters or a path to pre-configured parameter file. 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. name is parameters
|
||||
// supplied to the Create Virtual Machine Scale Set operation. parameters is
|
||||
|
@ -73,23 +73,23 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdate(resourceGroupName str
|
|||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client VirtualMachineScaleSetsClient) CreateOrUpdatePreparer(resourceGroupName string, name string, parameters VirtualMachineScaleSet, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"name": url.QueryEscape(name),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"name": autorest.Encode("path", name),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{name}"),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{name}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
|
@ -106,16 +106,18 @@ func (client VirtualMachineScaleSetsClient) CreateOrUpdateResponder(resp *http.R
|
|||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Deallocate the operation to deallocate virtual machines in a virtual
|
||||
// machine scale set. 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.
|
||||
// Deallocate allows you to deallocate virtual machines in a virtual machine
|
||||
// scale set. Shuts down the virtual machines and releases the compute
|
||||
// resources. You are not billed for the compute resources that this virtual
|
||||
// machine scale set uses. 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. vmScaleSetName is the
|
||||
// name of the virtual machine scale set. vmInstanceIDs is the list of
|
||||
|
@ -143,21 +145,20 @@ func (client VirtualMachineScaleSetsClient) Deallocate(resourceGroupName string,
|
|||
// DeallocatePreparer prepares the Deallocate request.
|
||||
func (client VirtualMachineScaleSetsClient) DeallocatePreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
if vmInstanceIDs != nil {
|
||||
preparer = autorest.DecoratePreparer(preparer,
|
||||
|
@ -186,7 +187,7 @@ func (client VirtualMachineScaleSetsClient) DeallocateResponder(resp *http.Respo
|
|||
return
|
||||
}
|
||||
|
||||
// Delete the operation to delete a virtual machine scale set. This method may
|
||||
// Delete allows you to delete a virtual machine scale set. 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.
|
||||
|
@ -216,22 +217,21 @@ func (client VirtualMachineScaleSetsClient) Delete(resourceGroupName string, vmS
|
|||
// DeletePreparer prepares the Delete request.
|
||||
func (client VirtualMachineScaleSetsClient) DeletePreparer(resourceGroupName string, vmScaleSetName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
|
@ -248,16 +248,16 @@ func (client VirtualMachineScaleSetsClient) DeleteResponder(resp *http.Response)
|
|||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK, http.StatusNoContent),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// DeleteInstances the operation to delete virtual machines in a virtual
|
||||
// machine scale set. 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.
|
||||
// DeleteInstances allows you to delete virtual machines in a virtual machine
|
||||
// scale set. 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. vmScaleSetName is the
|
||||
// name of the virtual machine scale set. vmInstanceIDs is the list of
|
||||
|
@ -285,23 +285,23 @@ func (client VirtualMachineScaleSetsClient) DeleteInstances(resourceGroupName st
|
|||
// DeleteInstancesPreparer prepares the DeleteInstances request.
|
||||
func (client VirtualMachineScaleSetsClient) DeleteInstancesPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete"),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete", pathParameters),
|
||||
autorest.WithJSON(vmInstanceIDs),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteInstancesSender sends the DeleteInstances request. The method will close the
|
||||
|
@ -324,7 +324,7 @@ func (client VirtualMachineScaleSetsClient) DeleteInstancesResponder(resp *http.
|
|||
return
|
||||
}
|
||||
|
||||
// Get the operation to get a virtual machine scale set.
|
||||
// Get display information about a virtual machine scale set.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
||||
// name of the virtual machine scale set.
|
||||
|
@ -351,22 +351,21 @@ func (client VirtualMachineScaleSetsClient) Get(resourceGroupName string, vmScal
|
|||
// GetPreparer prepares the Get request.
|
||||
func (client VirtualMachineScaleSetsClient) GetPreparer(resourceGroupName string, vmScaleSetName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
|
@ -388,8 +387,7 @@ func (client VirtualMachineScaleSetsClient) GetResponder(resp *http.Response) (r
|
|||
return
|
||||
}
|
||||
|
||||
// GetInstanceView the operation to get a virtual machine scale set instance
|
||||
// view.
|
||||
// GetInstanceView displays status of a virtual machine scale set instance.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
||||
// name of the virtual machine scale set.
|
||||
|
@ -416,22 +414,21 @@ func (client VirtualMachineScaleSetsClient) GetInstanceView(resourceGroupName st
|
|||
// GetInstanceViewPreparer prepares the GetInstanceView request.
|
||||
func (client VirtualMachineScaleSetsClient) GetInstanceViewPreparer(resourceGroupName string, vmScaleSetName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetInstanceViewSender sends the GetInstanceView request. The method will close the
|
||||
|
@ -453,8 +450,7 @@ func (client VirtualMachineScaleSetsClient) GetInstanceViewResponder(resp *http.
|
|||
return
|
||||
}
|
||||
|
||||
// List the operation to list virtual machine scale sets under a resource
|
||||
// group.
|
||||
// List lists all virtual machine scale sets under a resource group.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group.
|
||||
func (client VirtualMachineScaleSetsClient) List(resourceGroupName string) (result VirtualMachineScaleSetListResult, err error) {
|
||||
|
@ -480,21 +476,20 @@ func (client VirtualMachineScaleSetsClient) List(resourceGroupName string) (resu
|
|||
// ListPreparer prepares the List request.
|
||||
func (client VirtualMachineScaleSetsClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
@ -540,10 +535,10 @@ func (client VirtualMachineScaleSetsClient) ListNextResults(lastResults VirtualM
|
|||
return
|
||||
}
|
||||
|
||||
// ListAll gets the list of Virtual Machine Scale Sets in the subscription.
|
||||
// Use nextLink property in the response to get the next page of Virtual
|
||||
// Machine Scale Sets. Do this till nextLink is not null to fetch all the
|
||||
// Virtual Machine Scale Sets.
|
||||
// ListAll lists all Virtual Machine Scale Sets in the subscription. Use
|
||||
// nextLink property in the response to get the next page of Virtual Machine
|
||||
// Scale Sets. Do this till nextLink is not null to fetch all the Virtual
|
||||
// Machine Scale Sets.
|
||||
func (client VirtualMachineScaleSetsClient) ListAll() (result VirtualMachineScaleSetListWithLinkResult, err error) {
|
||||
req, err := client.ListAllPreparer()
|
||||
if err != nil {
|
||||
|
@ -567,20 +562,19 @@ func (client VirtualMachineScaleSetsClient) ListAll() (result VirtualMachineScal
|
|||
// ListAllPreparer prepares the ListAll request.
|
||||
func (client VirtualMachineScaleSetsClient) ListAllPreparer() (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListAllSender sends the ListAll request. The method will close the
|
||||
|
@ -626,8 +620,9 @@ func (client VirtualMachineScaleSetsClient) ListAllNextResults(lastResults Virtu
|
|||
return
|
||||
}
|
||||
|
||||
// ListSkus the operation to list available skus for a virtual machine scale
|
||||
// set.
|
||||
// ListSkus displays available skus for your virtual machine scale set
|
||||
// including the minimum and maximum vm instances allowed for a particular
|
||||
// sku.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
||||
// name of the virtual machine scale set.
|
||||
|
@ -654,22 +649,21 @@ func (client VirtualMachineScaleSetsClient) ListSkus(resourceGroupName string, v
|
|||
// ListSkusPreparer prepares the ListSkus request.
|
||||
func (client VirtualMachineScaleSetsClient) ListSkusPreparer(resourceGroupName string, vmScaleSetName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSkusSender sends the ListSkus request. The method will close the
|
||||
|
@ -715,10 +709,12 @@ func (client VirtualMachineScaleSetsClient) ListSkusNextResults(lastResults Virt
|
|||
return
|
||||
}
|
||||
|
||||
// PowerOff the operation to power off (stop) virtual machines in a virtual
|
||||
// machine scale set. 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.
|
||||
// PowerOff allows you to power off (stop) virtual machines in a virtual
|
||||
// machine scale set. Note that resources are still attached and you are
|
||||
// getting charged for the resources. Use deallocate to release resources.
|
||||
// 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. vmScaleSetName is the
|
||||
// name of the virtual machine scale set. vmInstanceIDs is the list of
|
||||
|
@ -746,21 +742,20 @@ func (client VirtualMachineScaleSetsClient) PowerOff(resourceGroupName string, v
|
|||
// PowerOffPreparer prepares the PowerOff request.
|
||||
func (client VirtualMachineScaleSetsClient) PowerOffPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
if vmInstanceIDs != nil {
|
||||
preparer = autorest.DecoratePreparer(preparer,
|
||||
|
@ -789,8 +784,76 @@ func (client VirtualMachineScaleSetsClient) PowerOffResponder(resp *http.Respons
|
|||
return
|
||||
}
|
||||
|
||||
// Restart the operation to restart virtual machines in a virtual machine
|
||||
// scale set. This method may poll for completion. Polling can be canceled by
|
||||
// Reimage allows you to re-image(update the version of the installed
|
||||
// operating system) virtual machines in a virtual machine scale set. 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. vmScaleSetName is the
|
||||
// name of the virtual machine scale set.
|
||||
func (client VirtualMachineScaleSetsClient) Reimage(resourceGroupName string, vmScaleSetName string, cancel <-chan struct{}) (result autorest.Response, err error) {
|
||||
req, err := client.ReimagePreparer(resourceGroupName, vmScaleSetName, cancel)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.ReimageSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.ReimageResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetsClient", "Reimage", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ReimagePreparer prepares the Reimage request.
|
||||
func (client VirtualMachineScaleSetsClient) ReimagePreparer(resourceGroupName string, vmScaleSetName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// ReimageSender sends the Reimage request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VirtualMachineScaleSetsClient) ReimageSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// ReimageResponder handles the response to the Reimage request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VirtualMachineScaleSetsClient) ReimageResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Restart allows you to restart virtual machines in a virtual machine scale
|
||||
// set. 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.
|
||||
//
|
||||
|
@ -820,21 +883,20 @@ func (client VirtualMachineScaleSetsClient) Restart(resourceGroupName string, vm
|
|||
// RestartPreparer prepares the Restart request.
|
||||
func (client VirtualMachineScaleSetsClient) RestartPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
if vmInstanceIDs != nil {
|
||||
preparer = autorest.DecoratePreparer(preparer,
|
||||
|
@ -863,10 +925,10 @@ func (client VirtualMachineScaleSetsClient) RestartResponder(resp *http.Response
|
|||
return
|
||||
}
|
||||
|
||||
// Start the operation to start virtual machines in a virtual machine scale
|
||||
// set. 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.
|
||||
// Start allows you to start virtual machines in a virtual machine scale set.
|
||||
// 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. vmScaleSetName is the
|
||||
// name of the virtual machine scale set. vmInstanceIDs is the list of
|
||||
|
@ -894,21 +956,20 @@ func (client VirtualMachineScaleSetsClient) Start(resourceGroupName string, vmSc
|
|||
// StartPreparer prepares the Start request.
|
||||
func (client VirtualMachineScaleSetsClient) StartPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs *VirtualMachineScaleSetVMInstanceIDs, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
if vmInstanceIDs != nil {
|
||||
preparer = autorest.DecoratePreparer(preparer,
|
||||
|
@ -937,7 +998,7 @@ func (client VirtualMachineScaleSetsClient) StartResponder(resp *http.Response)
|
|||
return
|
||||
}
|
||||
|
||||
// UpdateInstances the operation to manually upgrade virtual machines in a
|
||||
// UpdateInstances allows you to manually upgrade virtual machines in a
|
||||
// virtual machine scale set. 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.
|
||||
|
@ -968,23 +1029,23 @@ func (client VirtualMachineScaleSetsClient) UpdateInstances(resourceGroupName st
|
|||
// UpdateInstancesPreparer prepares the UpdateInstances request.
|
||||
func (client VirtualMachineScaleSetsClient) UpdateInstancesPreparer(resourceGroupName string, vmScaleSetName string, vmInstanceIDs VirtualMachineScaleSetVMInstanceRequiredIDs, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade"),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade", pathParameters),
|
||||
autorest.WithJSON(vmInstanceIDs),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// UpdateInstancesSender sends the UpdateInstances request. The method will close the
|
||||
|
|
257
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesetvms.go
generated
vendored
257
vendor/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinescalesetvms.go
generated
vendored
|
@ -14,7 +14,7 @@ package compute
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// VirtualMachineScaleSetVMsClient is the the Compute Management Client.
|
||||
|
@ -42,10 +41,12 @@ func NewVirtualMachineScaleSetVMsClientWithBaseURI(baseURI string, subscriptionI
|
|||
return VirtualMachineScaleSetVMsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Deallocate the operation to deallocate a virtual machine scale set. 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.
|
||||
// Deallocate allows you to deallocate a virtual machine scale set virtual
|
||||
// machine. Shuts down the virtual machine and releases the compute
|
||||
// resources. You are not billed for the compute resources that this virtual
|
||||
// machine uses. 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. vmScaleSetName is the
|
||||
// name of the virtual machine scale set. instanceID is the instance id of
|
||||
|
@ -73,23 +74,22 @@ func (client VirtualMachineScaleSetVMsClient) Deallocate(resourceGroupName strin
|
|||
// DeallocatePreparer prepares the Deallocate request.
|
||||
func (client VirtualMachineScaleSetVMsClient) DeallocatePreparer(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"instanceId": url.QueryEscape(instanceID),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"instanceId": autorest.Encode("path", instanceID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeallocateSender sends the Deallocate request. The method will close the
|
||||
|
@ -112,7 +112,7 @@ func (client VirtualMachineScaleSetVMsClient) DeallocateResponder(resp *http.Res
|
|||
return
|
||||
}
|
||||
|
||||
// Delete the operation to delete a virtual machine scale set. This method may
|
||||
// Delete allows you to delete a virtual machine scale set. 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.
|
||||
|
@ -143,23 +143,22 @@ func (client VirtualMachineScaleSetVMsClient) Delete(resourceGroupName string, v
|
|||
// DeletePreparer prepares the Delete request.
|
||||
func (client VirtualMachineScaleSetVMsClient) DeletePreparer(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"instanceId": url.QueryEscape(instanceID),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"instanceId": autorest.Encode("path", instanceID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
|
@ -176,13 +175,13 @@ func (client VirtualMachineScaleSetVMsClient) DeleteResponder(resp *http.Respons
|
|||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get the operation to get a virtual machine scale set virtual machine.
|
||||
// Get displays information about a virtual machine scale set virtual machine.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
||||
// name of the virtual machine scale set. instanceID is the instance id of
|
||||
|
@ -210,23 +209,22 @@ func (client VirtualMachineScaleSetVMsClient) Get(resourceGroupName string, vmSc
|
|||
// GetPreparer prepares the Get request.
|
||||
func (client VirtualMachineScaleSetVMsClient) GetPreparer(resourceGroupName string, vmScaleSetName string, instanceID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"instanceId": url.QueryEscape(instanceID),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"instanceId": autorest.Encode("path", instanceID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
|
@ -248,7 +246,7 @@ func (client VirtualMachineScaleSetVMsClient) GetResponder(resp *http.Response)
|
|||
return
|
||||
}
|
||||
|
||||
// GetInstanceView the operation to get a virtual machine scale set virtual
|
||||
// GetInstanceView displays the status of a virtual machine scale set virtual
|
||||
// machine.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. vmScaleSetName is the
|
||||
|
@ -277,23 +275,22 @@ func (client VirtualMachineScaleSetVMsClient) GetInstanceView(resourceGroupName
|
|||
// GetInstanceViewPreparer prepares the GetInstanceView request.
|
||||
func (client VirtualMachineScaleSetVMsClient) GetInstanceViewPreparer(resourceGroupName string, vmScaleSetName string, instanceID string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"instanceId": url.QueryEscape(instanceID),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"instanceId": autorest.Encode("path", instanceID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetInstanceViewSender sends the GetInstanceView request. The method will close the
|
||||
|
@ -315,7 +312,7 @@ func (client VirtualMachineScaleSetVMsClient) GetInstanceViewResponder(resp *htt
|
|||
return
|
||||
}
|
||||
|
||||
// List the operation to list virtual machine scale sets VMs.
|
||||
// List lists all virtual machines in a VM scale sets.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group.
|
||||
// virtualMachineScaleSetName is the name of the virtual machine scale set.
|
||||
|
@ -345,31 +342,30 @@ func (client VirtualMachineScaleSetVMsClient) List(resourceGroupName string, vir
|
|||
// ListPreparer prepares the List request.
|
||||
func (client VirtualMachineScaleSetVMsClient) ListPreparer(resourceGroupName string, virtualMachineScaleSetName string, filter string, selectParameter string, expand string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"virtualMachineScaleSetName": url.QueryEscape(virtualMachineScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
if len(filter) > 0 {
|
||||
queryParameters["$filter"] = filter
|
||||
queryParameters["$filter"] = autorest.Encode("query", filter)
|
||||
}
|
||||
if len(selectParameter) > 0 {
|
||||
queryParameters["$select"] = selectParameter
|
||||
queryParameters["$select"] = autorest.Encode("query", selectParameter)
|
||||
}
|
||||
if len(expand) > 0 {
|
||||
queryParameters["$expand"] = expand
|
||||
queryParameters["$expand"] = autorest.Encode("query", expand)
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
@ -415,10 +411,10 @@ func (client VirtualMachineScaleSetVMsClient) ListNextResults(lastResults Virtua
|
|||
return
|
||||
}
|
||||
|
||||
// PowerOff the operation to power off (stop) a virtual machine scale set.
|
||||
// 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.
|
||||
// PowerOff allows you to power off (stop) a virtual machine in a VM scale
|
||||
// set. 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. vmScaleSetName is the
|
||||
// name of the virtual machine scale set. instanceID is the instance id of
|
||||
|
@ -446,23 +442,22 @@ func (client VirtualMachineScaleSetVMsClient) PowerOff(resourceGroupName string,
|
|||
// PowerOffPreparer prepares the PowerOff request.
|
||||
func (client VirtualMachineScaleSetVMsClient) PowerOffPreparer(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"instanceId": url.QueryEscape(instanceID),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"instanceId": autorest.Encode("path", instanceID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// PowerOffSender sends the PowerOff request. The method will close the
|
||||
|
@ -485,10 +480,80 @@ func (client VirtualMachineScaleSetVMsClient) PowerOffResponder(resp *http.Respo
|
|||
return
|
||||
}
|
||||
|
||||
// Restart the operation to restart a virtual machine scale set. 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.
|
||||
// Reimage allows you to re-image(update the version of the installed
|
||||
// operating system) a virtual machine scale set instance. 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. vmScaleSetName is the
|
||||
// name of the virtual machine scale set. instanceID is the instance id of
|
||||
// the virtual machine.
|
||||
func (client VirtualMachineScaleSetVMsClient) Reimage(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (result autorest.Response, err error) {
|
||||
req, err := client.ReimagePreparer(resourceGroupName, vmScaleSetName, instanceID, cancel)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.ReimageSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.ReimageResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineScaleSetVMsClient", "Reimage", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ReimagePreparer prepares the Reimage request.
|
||||
func (client VirtualMachineScaleSetVMsClient) ReimagePreparer(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"instanceId": autorest.Encode("path", instanceID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// ReimageSender sends the Reimage request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VirtualMachineScaleSetVMsClient) ReimageSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// ReimageResponder handles the response to the Reimage request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VirtualMachineScaleSetVMsClient) ReimageResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Restart allows you to restart a virtual machine in a VM scale set. 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. vmScaleSetName is the
|
||||
// name of the virtual machine scale set. instanceID is the instance id of
|
||||
|
@ -516,23 +581,22 @@ func (client VirtualMachineScaleSetVMsClient) Restart(resourceGroupName string,
|
|||
// RestartPreparer prepares the Restart request.
|
||||
func (client VirtualMachineScaleSetVMsClient) RestartPreparer(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"instanceId": url.QueryEscape(instanceID),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"instanceId": autorest.Encode("path", instanceID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// RestartSender sends the Restart request. The method will close the
|
||||
|
@ -555,10 +619,10 @@ func (client VirtualMachineScaleSetVMsClient) RestartResponder(resp *http.Respon
|
|||
return
|
||||
}
|
||||
|
||||
// Start the operation to start a virtual machine scale set. 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.
|
||||
// Start allows you to start a virtual machine in a VM scale set. 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. vmScaleSetName is the
|
||||
// name of the virtual machine scale set. instanceID is the instance id of
|
||||
|
@ -586,23 +650,22 @@ func (client VirtualMachineScaleSetVMsClient) Start(resourceGroupName string, vm
|
|||
// StartPreparer prepares the Start request.
|
||||
func (client VirtualMachineScaleSetVMsClient) StartPreparer(resourceGroupName string, vmScaleSetName string, instanceID string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"instanceId": url.QueryEscape(instanceID),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"vmScaleSetName": url.QueryEscape(vmScaleSetName),
|
||||
"instanceId": autorest.Encode("path", instanceID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"vmScaleSetName": autorest.Encode("path", vmScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// StartSender sends the Start request. The method will close the
|
||||
|
|
|
@ -14,7 +14,7 @@ package compute
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// VirtualMachineSizesClient is the the Compute Management Client.
|
||||
|
@ -42,7 +41,8 @@ func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID stri
|
|||
return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// List lists virtual-machine-sizes available in a location for a subscription.
|
||||
// List lists all available virtual machine sizes for a subscription in a
|
||||
// location.
|
||||
//
|
||||
// location is the location upon which virtual-machine-sizes is queried.
|
||||
func (client VirtualMachineSizesClient) List(location string) (result VirtualMachineSizeListResult, err error) {
|
||||
|
@ -68,21 +68,20 @@ func (client VirtualMachineSizesClient) List(location string) (result VirtualMac
|
|||
// ListPreparer prepares the List request.
|
||||
func (client VirtualMachineSizesClient) ListPreparer(location string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"location": url.QueryEscape(location),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"location": autorest.Encode("path", location),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
@ -103,27 +102,3 @@ func (client VirtualMachineSizesClient) ListResponder(resp *http.Response) (resu
|
|||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListNextResults retrieves the next set of results, if any.
|
||||
func (client VirtualMachineSizesClient) ListNextResults(lastResults VirtualMachineSizeListResult) (result VirtualMachineSizeListResult, err error) {
|
||||
req, err := lastResults.VirtualMachineSizeListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", nil, "Failure preparing next results request request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure sending next results request request")
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "compute.VirtualMachineSizesClient", "List", resp, "Failure responding to next results request request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ package network
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// ApplicationGatewaysClient is the the Microsoft Azure Network management API
|
||||
|
@ -77,23 +76,23 @@ func (client ApplicationGatewaysClient) CreateOrUpdate(resourceGroupName string,
|
|||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client ApplicationGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, applicationGatewayName string, parameters ApplicationGateway, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationGatewayName": url.QueryEscape(applicationGatewayName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}"),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
|
@ -146,22 +145,21 @@ func (client ApplicationGatewaysClient) Delete(resourceGroupName string, applica
|
|||
// DeletePreparer prepares the Delete request.
|
||||
func (client ApplicationGatewaysClient) DeletePreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationGatewayName": url.QueryEscape(applicationGatewayName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
|
@ -212,22 +210,21 @@ func (client ApplicationGatewaysClient) Get(resourceGroupName string, applicatio
|
|||
// GetPreparer prepares the Get request.
|
||||
func (client ApplicationGatewaysClient) GetPreparer(resourceGroupName string, applicationGatewayName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationGatewayName": url.QueryEscape(applicationGatewayName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
|
@ -276,21 +273,20 @@ func (client ApplicationGatewaysClient) List(resourceGroupName string) (result A
|
|||
// ListPreparer prepares the List request.
|
||||
func (client ApplicationGatewaysClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
@ -361,20 +357,19 @@ func (client ApplicationGatewaysClient) ListAll() (result ApplicationGatewayList
|
|||
// ListAllPreparer prepares the ListAll request.
|
||||
func (client ApplicationGatewaysClient) ListAllPreparer() (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/applicationGateways", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListAllSender sends the ListAll request. The method will close the
|
||||
|
@ -451,22 +446,21 @@ func (client ApplicationGatewaysClient) Start(resourceGroupName string, applicat
|
|||
// StartPreparer prepares the Start request.
|
||||
func (client ApplicationGatewaysClient) StartPreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationGatewayName": url.QueryEscape(applicationGatewayName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/start", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// StartSender sends the Start request. The method will close the
|
||||
|
@ -520,22 +514,21 @@ func (client ApplicationGatewaysClient) Stop(resourceGroupName string, applicati
|
|||
// StopPreparer prepares the Stop request.
|
||||
func (client ApplicationGatewaysClient) StopPreparer(resourceGroupName string, applicationGatewayName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"applicationGatewayName": url.QueryEscape(applicationGatewayName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"applicationGatewayName": autorest.Encode("path", applicationGatewayName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/stop", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// StopSender sends the Stop request. The method will close the
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Package network implements the Azure ARM Network service API version
|
||||
// 2015-06-15.
|
||||
// 2016-03-30.
|
||||
//
|
||||
// The Microsoft Azure Network management API provides a RESTful set of web
|
||||
// services that interact with Microsoft Azure Networks service to manage
|
||||
|
@ -21,7 +21,7 @@ package network
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -29,12 +29,11 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
const (
|
||||
// APIVersion is the version of the Network
|
||||
APIVersion = "2015-06-15"
|
||||
APIVersion = "2016-03-30"
|
||||
|
||||
// DefaultBaseURI is the default URI used for the service Network
|
||||
DefaultBaseURI = "https://management.azure.com"
|
||||
|
@ -44,6 +43,7 @@ const (
|
|||
type ManagementClient struct {
|
||||
autorest.Client
|
||||
BaseURI string
|
||||
APIVersion string
|
||||
SubscriptionID string
|
||||
}
|
||||
|
||||
|
@ -57,6 +57,7 @@ func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
|
|||
return ManagementClient{
|
||||
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||
BaseURI: baseURI,
|
||||
APIVersion: APIVersion,
|
||||
SubscriptionID: subscriptionID,
|
||||
}
|
||||
}
|
||||
|
@ -90,24 +91,23 @@ func (client ManagementClient) CheckDNSNameAvailability(location string, domainN
|
|||
// CheckDNSNameAvailabilityPreparer prepares the CheckDNSNameAvailability request.
|
||||
func (client ManagementClient) CheckDNSNameAvailabilityPreparer(location string, domainNameLabel string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"location": url.QueryEscape(location),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"location": autorest.Encode("path", location),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
if len(domainNameLabel) > 0 {
|
||||
queryParameters["domainNameLabel"] = domainNameLabel
|
||||
queryParameters["domainNameLabel"] = autorest.Encode("query", domainNameLabel)
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/locations/{location}/CheckDnsNameAvailability", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CheckDNSNameAvailabilitySender sends the CheckDNSNameAvailability request. The method will close the
|
||||
|
|
|
@ -14,7 +14,7 @@ package network
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// ExpressRouteCircuitAuthorizationsClient is the the Microsoft Azure Network
|
||||
|
@ -79,24 +78,24 @@ func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdate(resourceGro
|
|||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client ExpressRouteCircuitAuthorizationsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, authorizationName string, authorizationParameters ExpressRouteCircuitAuthorization, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"authorizationName": url.QueryEscape(authorizationName),
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"authorizationName": autorest.Encode("path", authorizationName),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}"),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters),
|
||||
autorest.WithJSON(authorizationParameters),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
|
@ -151,23 +150,22 @@ func (client ExpressRouteCircuitAuthorizationsClient) Delete(resourceGroupName s
|
|||
// DeletePreparer prepares the Delete request.
|
||||
func (client ExpressRouteCircuitAuthorizationsClient) DeletePreparer(resourceGroupName string, circuitName string, authorizationName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"authorizationName": url.QueryEscape(authorizationName),
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"authorizationName": autorest.Encode("path", authorizationName),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
|
@ -219,23 +217,22 @@ func (client ExpressRouteCircuitAuthorizationsClient) Get(resourceGroupName stri
|
|||
// GetPreparer prepares the Get request.
|
||||
func (client ExpressRouteCircuitAuthorizationsClient) GetPreparer(resourceGroupName string, circuitName string, authorizationName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"authorizationName": url.QueryEscape(authorizationName),
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"authorizationName": autorest.Encode("path", authorizationName),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations/{authorizationName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
|
@ -285,22 +282,21 @@ func (client ExpressRouteCircuitAuthorizationsClient) List(resourceGroupName str
|
|||
// ListPreparer prepares the List request.
|
||||
func (client ExpressRouteCircuitAuthorizationsClient) ListPreparer(resourceGroupName string, circuitName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/authorizations", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
|
68
vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitpeerings.go
generated
vendored
68
vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressroutecircuitpeerings.go
generated
vendored
|
@ -14,7 +14,7 @@ package network
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// ExpressRouteCircuitPeeringsClient is the the Microsoft Azure Network
|
||||
|
@ -78,24 +77,24 @@ func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdate(resourceGroupName
|
|||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client ExpressRouteCircuitPeeringsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, peeringName string, peeringParameters ExpressRouteCircuitPeering, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"peeringName": url.QueryEscape(peeringName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"peeringName": autorest.Encode("path", peeringName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}"),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters),
|
||||
autorest.WithJSON(peeringParameters),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
|
@ -148,23 +147,22 @@ func (client ExpressRouteCircuitPeeringsClient) Delete(resourceGroupName string,
|
|||
// DeletePreparer prepares the Delete request.
|
||||
func (client ExpressRouteCircuitPeeringsClient) DeletePreparer(resourceGroupName string, circuitName string, peeringName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"peeringName": url.QueryEscape(peeringName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"peeringName": autorest.Encode("path", peeringName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
|
@ -215,23 +213,22 @@ func (client ExpressRouteCircuitPeeringsClient) Get(resourceGroupName string, ci
|
|||
// GetPreparer prepares the Get request.
|
||||
func (client ExpressRouteCircuitPeeringsClient) GetPreparer(resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"peeringName": url.QueryEscape(peeringName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"peeringName": autorest.Encode("path", peeringName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
|
@ -281,22 +278,21 @@ func (client ExpressRouteCircuitPeeringsClient) List(resourceGroupName string, c
|
|||
// ListPreparer prepares the List request.
|
||||
func (client ExpressRouteCircuitPeeringsClient) ListPreparer(resourceGroupName string, circuitName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
|
|
@ -14,7 +14,7 @@ package network
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// ExpressRouteCircuitsClient is the the Microsoft Azure Network management
|
||||
|
@ -77,23 +76,23 @@ func (client ExpressRouteCircuitsClient) CreateOrUpdate(resourceGroupName string
|
|||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client ExpressRouteCircuitsClient) CreateOrUpdatePreparer(resourceGroupName string, circuitName string, parameters ExpressRouteCircuit, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/"),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
|
@ -146,22 +145,21 @@ func (client ExpressRouteCircuitsClient) Delete(resourceGroupName string, circui
|
|||
// DeletePreparer prepares the Delete request.
|
||||
func (client ExpressRouteCircuitsClient) DeletePreparer(resourceGroupName string, circuitName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
|
@ -212,22 +210,21 @@ func (client ExpressRouteCircuitsClient) Get(resourceGroupName string, circuitNa
|
|||
// GetPreparer prepares the Get request.
|
||||
func (client ExpressRouteCircuitsClient) GetPreparer(resourceGroupName string, circuitName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
|
@ -249,6 +246,135 @@ func (client ExpressRouteCircuitsClient) GetResponder(resp *http.Response) (resu
|
|||
return
|
||||
}
|
||||
|
||||
// GetPeeringStats the Liststats ExpressRouteCircuit opertion retrieves all
|
||||
// the stats from a ExpressRouteCircuits in a resource group.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. circuitName is the
|
||||
// name of the circuit. peeringName is the name of the peering.
|
||||
func (client ExpressRouteCircuitsClient) GetPeeringStats(resourceGroupName string, circuitName string, peeringName string) (result ExpressRouteCircuitStats, err error) {
|
||||
req, err := client.GetPeeringStatsPreparer(resourceGroupName, circuitName, peeringName)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.GetPeeringStatsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.GetPeeringStatsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetPeeringStats", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPeeringStatsPreparer prepares the GetPeeringStats request.
|
||||
func (client ExpressRouteCircuitsClient) GetPeeringStatsPreparer(resourceGroupName string, circuitName string, peeringName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"peeringName": autorest.Encode("path", peeringName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/stats", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetPeeringStatsSender sends the GetPeeringStats request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ExpressRouteCircuitsClient) GetPeeringStatsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetPeeringStatsResponder handles the response to the GetPeeringStats request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ExpressRouteCircuitsClient) GetPeeringStatsResponder(resp *http.Response) (result ExpressRouteCircuitStats, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetStats the Liststats ExpressRouteCircuit opertion retrieves all the stats
|
||||
// from a ExpressRouteCircuits in a resource group.
|
||||
//
|
||||
// resourceGroupName is the name of the resource group. circuitName is the
|
||||
// name of the circuit.
|
||||
func (client ExpressRouteCircuitsClient) GetStats(resourceGroupName string, circuitName string) (result ExpressRouteCircuitStats, err error) {
|
||||
req, err := client.GetStatsPreparer(resourceGroupName, circuitName)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.GetStatsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.GetStatsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "GetStats", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetStatsPreparer prepares the GetStats request.
|
||||
func (client ExpressRouteCircuitsClient) GetStatsPreparer(resourceGroupName string, circuitName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetStatsSender sends the GetStats request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ExpressRouteCircuitsClient) GetStatsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetStatsResponder handles the response to the GetStats request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ExpressRouteCircuitsClient) GetStatsResponder(resp *http.Response) (result ExpressRouteCircuitStats, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// List the List ExpressRouteCircuit opertion retrieves all the
|
||||
// ExpressRouteCircuits in a resource group.
|
||||
//
|
||||
|
@ -276,21 +402,20 @@ func (client ExpressRouteCircuitsClient) List(resourceGroupName string) (result
|
|||
// ListPreparer prepares the List request.
|
||||
func (client ExpressRouteCircuitsClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
@ -361,20 +486,19 @@ func (client ExpressRouteCircuitsClient) ListAll() (result ExpressRouteCircuitLi
|
|||
// ListAllPreparer prepares the ListAll request.
|
||||
func (client ExpressRouteCircuitsClient) ListAllPreparer() (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCircuits", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListAllSender sends the ListAll request. The method will close the
|
||||
|
@ -422,19 +546,23 @@ func (client ExpressRouteCircuitsClient) ListAllNextResults(lastResults ExpressR
|
|||
|
||||
// ListArpTable the ListArpTable from ExpressRouteCircuit opertion retrieves
|
||||
// the currently advertised arp table associated with the
|
||||
// ExpressRouteCircuits in a resource group.
|
||||
// ExpressRouteCircuits 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 circuit.
|
||||
func (client ExpressRouteCircuitsClient) ListArpTable(resourceGroupName string, circuitName string) (result ExpressRouteCircuitsArpTableListResult, err error) {
|
||||
req, err := client.ListArpTablePreparer(resourceGroupName, circuitName)
|
||||
// name of the 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{}) (result autorest.Response, err error) {
|
||||
req, err := client.ListArpTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.ListArpTableSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
result.Response = resp
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
|
@ -447,84 +575,66 @@ func (client ExpressRouteCircuitsClient) ListArpTable(resourceGroupName string,
|
|||
}
|
||||
|
||||
// ListArpTablePreparer prepares the ListArpTable request.
|
||||
func (client ExpressRouteCircuitsClient) ListArpTablePreparer(resourceGroupName string, circuitName string) (*http.Request, error) {
|
||||
func (client ExpressRouteCircuitsClient) ListArpTablePreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"devicePath": autorest.Encode("path", devicePath),
|
||||
"peeringName": autorest.Encode("path", peeringName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/arpTable"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// ListArpTableSender sends the ListArpTable request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ExpressRouteCircuitsClient) ListArpTableSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// ListArpTableResponder handles the response to the ListArpTable request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ExpressRouteCircuitsClient) ListArpTableResponder(resp *http.Response) (result ExpressRouteCircuitsArpTableListResult, err error) {
|
||||
func (client ExpressRouteCircuitsClient) ListArpTableResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListArpTableNextResults retrieves the next set of results, if any.
|
||||
func (client ExpressRouteCircuitsClient) ListArpTableNextResults(lastResults ExpressRouteCircuitsArpTableListResult) (result ExpressRouteCircuitsArpTableListResult, err error) {
|
||||
req, err := lastResults.ExpressRouteCircuitsArpTableListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", nil, "Failure preparing next results request request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListArpTableSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure sending next results request request")
|
||||
}
|
||||
|
||||
result, err = client.ListArpTableResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListArpTable", resp, "Failure responding to next results request request")
|
||||
}
|
||||
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// ListRoutesTable the ListRoutesTable from ExpressRouteCircuit opertion
|
||||
// retrieves the currently advertised routes table associated with the
|
||||
// ExpressRouteCircuits in a resource group.
|
||||
// ExpressRouteCircuits 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 circuit.
|
||||
func (client ExpressRouteCircuitsClient) ListRoutesTable(resourceGroupName string, circuitName string) (result ExpressRouteCircuitsRoutesTableListResult, err error) {
|
||||
req, err := client.ListRoutesTablePreparer(resourceGroupName, circuitName)
|
||||
// name of the circuit. 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{}) (result autorest.Response, err error) {
|
||||
req, err := client.ListRoutesTablePreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.ListRoutesTableSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
result.Response = resp
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
|
@ -537,154 +647,115 @@ func (client ExpressRouteCircuitsClient) ListRoutesTable(resourceGroupName strin
|
|||
}
|
||||
|
||||
// ListRoutesTablePreparer prepares the ListRoutesTable request.
|
||||
func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(resourceGroupName string, circuitName string) (*http.Request, error) {
|
||||
func (client ExpressRouteCircuitsClient) ListRoutesTablePreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"devicePath": autorest.Encode("path", devicePath),
|
||||
"peeringName": autorest.Encode("path", peeringName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/routesTable"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// ListRoutesTableSender sends the ListRoutesTable request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ExpressRouteCircuitsClient) ListRoutesTableSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ExpressRouteCircuitsClient) ListRoutesTableResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableListResult, err error) {
|
||||
func (client ExpressRouteCircuitsClient) ListRoutesTableResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// ListRoutesTableNextResults retrieves the next set of results, if any.
|
||||
func (client ExpressRouteCircuitsClient) ListRoutesTableNextResults(lastResults ExpressRouteCircuitsRoutesTableListResult) (result ExpressRouteCircuitsRoutesTableListResult, err error) {
|
||||
req, err := lastResults.ExpressRouteCircuitsRoutesTableListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", nil, "Failure preparing next results request request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListRoutesTableSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure sending next results request request")
|
||||
}
|
||||
|
||||
result, err = client.ListRoutesTableResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTable", resp, "Failure responding to next results request request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListStats the Liststats ExpressRouteCircuit opertion retrieves all the
|
||||
// stats from a ExpressRouteCircuits in a resource group.
|
||||
// ListRoutesTableSummary the ListRoutesTable from ExpressRouteCircuit
|
||||
// opertion retrieves the currently advertised routes table associated with
|
||||
// the ExpressRouteCircuits 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 loadBalancer.
|
||||
func (client ExpressRouteCircuitsClient) ListStats(resourceGroupName string, circuitName string) (result ExpressRouteCircuitsStatsListResult, err error) {
|
||||
req, err := client.ListStatsPreparer(resourceGroupName, circuitName)
|
||||
// name of the circuit. 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{}) (result autorest.Response, err error) {
|
||||
req, err := client.ListRoutesTableSummaryPreparer(resourceGroupName, circuitName, peeringName, devicePath, cancel)
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListStats", nil, "Failure preparing request")
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", nil, "Failure preparing request")
|
||||
}
|
||||
|
||||
resp, err := client.ListStatsSender(req)
|
||||
resp, err := client.ListRoutesTableSummarySender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListStats", resp, "Failure sending request")
|
||||
result.Response = resp
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", resp, "Failure sending request")
|
||||
}
|
||||
|
||||
result, err = client.ListStatsResponder(resp)
|
||||
result, err = client.ListRoutesTableSummaryResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListStats", resp, "Failure responding to request")
|
||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListRoutesTableSummary", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListStatsPreparer prepares the ListStats request.
|
||||
func (client ExpressRouteCircuitsClient) ListStatsPreparer(resourceGroupName string, circuitName string) (*http.Request, error) {
|
||||
// ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request.
|
||||
func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryPreparer(resourceGroupName string, circuitName string, peeringName string, devicePath string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"circuitName": url.QueryEscape(circuitName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"circuitName": autorest.Encode("path", circuitName),
|
||||
"devicePath": autorest.Encode("path", devicePath),
|
||||
"peeringName": autorest.Encode("path", peeringName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/stats"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCircuits/{circuitName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// ListStatsSender sends the ListStats request. The method will close the
|
||||
// ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ExpressRouteCircuitsClient) ListStatsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
func (client ExpressRouteCircuitsClient) ListRoutesTableSummarySender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// ListStatsResponder handles the response to the ListStats request. The method always
|
||||
// ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ExpressRouteCircuitsClient) ListStatsResponder(resp *http.Response) (result ExpressRouteCircuitsStatsListResult, err error) {
|
||||
func (client ExpressRouteCircuitsClient) ListRoutesTableSummaryResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListStatsNextResults retrieves the next set of results, if any.
|
||||
func (client ExpressRouteCircuitsClient) ListStatsNextResults(lastResults ExpressRouteCircuitsStatsListResult) (result ExpressRouteCircuitsStatsListResult, err error) {
|
||||
req, err := lastResults.ExpressRouteCircuitsStatsListResultPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListStats", nil, "Failure preparing next results request request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListStatsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListStats", resp, "Failure sending next results request request")
|
||||
}
|
||||
|
||||
result, err = client.ListStatsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "network.ExpressRouteCircuitsClient", "ListStats", resp, "Failure responding to next results request request")
|
||||
}
|
||||
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
|
14
vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressrouteserviceproviders.go
generated
vendored
14
vendor/github.com/Azure/azure-sdk-for-go/arm/network/expressrouteserviceproviders.go
generated
vendored
|
@ -14,7 +14,7 @@ package network
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// ExpressRouteServiceProvidersClient is the the Microsoft Azure Network
|
||||
|
@ -71,20 +70,19 @@ func (client ExpressRouteServiceProvidersClient) List() (result ExpressRouteServ
|
|||
// ListPreparer prepares the List request.
|
||||
func (client ExpressRouteServiceProvidersClient) ListPreparer() (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteServiceProviders", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
|
|
@ -14,7 +14,7 @@ package network
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.14.0.0
|
||||
// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
|
@ -22,7 +22,6 @@ import (
|
|||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// InterfacesClient is the the Microsoft Azure Network management API provides
|
||||
|
@ -76,23 +75,23 @@ func (client InterfacesClient) CreateOrUpdate(resourceGroupName string, networkI
|
|||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client InterfacesClient) CreateOrUpdatePreparer(resourceGroupName string, networkInterfaceName string, parameters Interface, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"networkInterfaceName": url.QueryEscape(networkInterfaceName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
|
@ -145,22 +144,21 @@ func (client InterfacesClient) Delete(resourceGroupName string, networkInterface
|
|||
// DeletePreparer prepares the Delete request.
|
||||
func (client InterfacesClient) DeletePreparer(resourceGroupName string, networkInterfaceName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"networkInterfaceName": url.QueryEscape(networkInterfaceName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{Cancel: cancel},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
|
@ -212,25 +210,24 @@ func (client InterfacesClient) Get(resourceGroupName string, networkInterfaceNam
|
|||
// GetPreparer prepares the Get request.
|
||||
func (client InterfacesClient) GetPreparer(resourceGroupName string, networkInterfaceName string, expand string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"networkInterfaceName": url.QueryEscape(networkInterfaceName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
if len(expand) > 0 {
|
||||
queryParameters["$expand"] = expand
|
||||
queryParameters["$expand"] = autorest.Encode("query", expand)
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces/{networkInterfaceName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
|
@ -283,27 +280,26 @@ func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterface(resourc
|
|||
// GetVirtualMachineScaleSetNetworkInterfacePreparer prepares the GetVirtualMachineScaleSetNetworkInterface request.
|
||||
func (client InterfacesClient) GetVirtualMachineScaleSetNetworkInterfacePreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string, networkInterfaceName string, expand string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"networkInterfaceName": url.QueryEscape(networkInterfaceName),
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"virtualmachineIndex": url.QueryEscape(virtualmachineIndex),
|
||||
"virtualMachineScaleSetName": url.QueryEscape(virtualMachineScaleSetName),
|
||||
"networkInterfaceName": autorest.Encode("path", networkInterfaceName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"virtualmachineIndex": autorest.Encode("path", virtualmachineIndex),
|
||||
"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
if len(expand) > 0 {
|
||||
queryParameters["$expand"] = expand
|
||||
queryParameters["$expand"] = autorest.Encode("query", expand)
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetVirtualMachineScaleSetNetworkInterfaceSender sends the GetVirtualMachineScaleSetNetworkInterface request. The method will close the
|
||||
|
@ -352,21 +348,20 @@ func (client InterfacesClient) List(resourceGroupName string) (result InterfaceL
|
|||
// ListPreparer prepares the List request.
|
||||
func (client InterfacesClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkInterfaces", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSender sends the List request. The method will close the
|
||||
|
@ -437,20 +432,19 @@ func (client InterfacesClient) ListAll() (result InterfaceListResult, err error)
|
|||
// ListAllPreparer prepares the ListAll request.
|
||||
func (client InterfacesClient) ListAllPreparer() (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkInterfaces", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListAllSender sends the ListAll request. The method will close the
|
||||
|
@ -525,22 +519,21 @@ func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfaces(resou
|
|||
// ListVirtualMachineScaleSetNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetNetworkInterfaces request.
|
||||
func (client InterfacesClient) ListVirtualMachineScaleSetNetworkInterfacesPreparer(resourceGroupName string, virtualMachineScaleSetName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"virtualMachineScaleSetName": url.QueryEscape(virtualMachineScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/networkInterfaces", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListVirtualMachineScaleSetNetworkInterfacesSender sends the ListVirtualMachineScaleSetNetworkInterfaces request. The method will close the
|
||||
|
@ -616,23 +609,22 @@ func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfaces(res
|
|||
// ListVirtualMachineScaleSetVMNetworkInterfacesPreparer prepares the ListVirtualMachineScaleSetVMNetworkInterfaces request.
|
||||
func (client InterfacesClient) ListVirtualMachineScaleSetVMNetworkInterfacesPreparer(resourceGroupName string, virtualMachineScaleSetName string, virtualmachineIndex string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"resourceGroupName": url.QueryEscape(resourceGroupName),
|
||||
"subscriptionId": url.QueryEscape(client.SubscriptionID),
|
||||
"virtualmachineIndex": url.QueryEscape(virtualmachineIndex),
|
||||
"virtualMachineScaleSetName": url.QueryEscape(virtualMachineScaleSetName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"virtualmachineIndex": autorest.Encode("path", virtualmachineIndex),
|
||||
"virtualMachineScaleSetName": autorest.Encode("path", virtualMachineScaleSetName),
|
||||
}
|
||||
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"api-version": client.APIVersion,
|
||||
}
|
||||
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces"),
|
||||
autorest.WithPathParameters(pathParameters),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListVirtualMachineScaleSetVMNetworkInterfacesSender sends the ListVirtualMachineScaleSetVMNetworkInterfaces request. The method will close the
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue