github.com/yoctocloud/packer@v0.6.2-0.20160520224004-e11a0a18423f/builder/azure/arm/tempname.go (about) 1 // Copyright (c) Microsoft Corporation. All rights reserved. 2 // Licensed under the MIT License. See the LICENSE file in builder/azure for license information. 3 4 package arm 5 6 import ( 7 "fmt" 8 9 "github.com/mitchellh/packer/builder/azure/common" 10 ) 11 12 const ( 13 TempNameAlphabet = "0123456789bcdfghjklmnpqrstvwxyz" 14 TempPasswordAlphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" 15 ) 16 17 type TempName struct { 18 AdminPassword string 19 CertificatePassword string 20 ComputeName string 21 DeploymentName string 22 KeyVaultName string 23 ResourceGroupName string 24 OSDiskName string 25 } 26 27 func NewTempName() *TempName { 28 tempName := &TempName{} 29 30 suffix := common.RandomString(TempNameAlphabet, 10) 31 tempName.ComputeName = fmt.Sprintf("pkrvm%s", suffix) 32 tempName.DeploymentName = fmt.Sprintf("pkrdp%s", suffix) 33 tempName.KeyVaultName = fmt.Sprintf("pkrkv%s", suffix) 34 tempName.OSDiskName = fmt.Sprintf("pkros%s", suffix) 35 tempName.ResourceGroupName = fmt.Sprintf("packer-Resource-Group-%s", suffix) 36 37 tempName.AdminPassword = common.RandomString(TempPasswordAlphabet, 32) 38 tempName.CertificatePassword = common.RandomString(TempPasswordAlphabet, 32) 39 40 return tempName 41 }