github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/builder/azure/arm/tempname.go (about) 1 package arm 2 3 import ( 4 "fmt" 5 6 "github.com/hashicorp/packer/builder/azure/common" 7 ) 8 9 const ( 10 TempNameAlphabet = "0123456789bcdfghjklmnpqrstvwxyz" 11 TempPasswordAlphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" 12 ) 13 14 type TempName struct { 15 AdminPassword string 16 CertificatePassword string 17 ComputeName string 18 DeploymentName string 19 KeyVaultName string 20 ResourceGroupName string 21 OSDiskName string 22 } 23 24 func NewTempName() *TempName { 25 tempName := &TempName{} 26 27 suffix := common.RandomString(TempNameAlphabet, 10) 28 tempName.ComputeName = fmt.Sprintf("pkrvm%s", suffix) 29 tempName.DeploymentName = fmt.Sprintf("pkrdp%s", suffix) 30 tempName.KeyVaultName = fmt.Sprintf("pkrkv%s", suffix) 31 tempName.OSDiskName = fmt.Sprintf("pkros%s", suffix) 32 tempName.ResourceGroupName = fmt.Sprintf("packer-Resource-Group-%s", suffix) 33 34 tempName.AdminPassword = common.RandomString(TempPasswordAlphabet, 32) 35 tempName.CertificatePassword = common.RandomString(TempPasswordAlphabet, 32) 36 37 return tempName 38 }