2016-03-04 05:14:55 -05:00
|
|
|
package arm
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2017-04-04 16:39:01 -04:00
|
|
|
"github.com/hashicorp/packer/builder/azure/common"
|
2016-03-04 05:14:55 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
TempNameAlphabet = "0123456789bcdfghjklmnpqrstvwxyz"
|
|
|
|
TempPasswordAlphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
|
|
)
|
|
|
|
|
|
|
|
type TempName struct {
|
2016-04-21 19:50:03 -04:00
|
|
|
AdminPassword string
|
|
|
|
CertificatePassword string
|
|
|
|
ComputeName string
|
|
|
|
DeploymentName string
|
|
|
|
KeyVaultName string
|
|
|
|
ResourceGroupName string
|
|
|
|
OSDiskName string
|
2016-03-04 05:14:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewTempName() *TempName {
|
|
|
|
tempName := &TempName{}
|
|
|
|
|
|
|
|
suffix := common.RandomString(TempNameAlphabet, 10)
|
|
|
|
tempName.ComputeName = fmt.Sprintf("pkrvm%s", suffix)
|
|
|
|
tempName.DeploymentName = fmt.Sprintf("pkrdp%s", suffix)
|
2016-04-21 19:50:03 -04:00
|
|
|
tempName.KeyVaultName = fmt.Sprintf("pkrkv%s", suffix)
|
2016-03-04 05:14:55 -05:00
|
|
|
tempName.OSDiskName = fmt.Sprintf("pkros%s", suffix)
|
|
|
|
tempName.ResourceGroupName = fmt.Sprintf("packer-Resource-Group-%s", suffix)
|
|
|
|
|
|
|
|
tempName.AdminPassword = common.RandomString(TempPasswordAlphabet, 32)
|
2016-04-21 19:50:03 -04:00
|
|
|
tempName.CertificatePassword = common.RandomString(TempPasswordAlphabet, 32)
|
2016-03-04 05:14:55 -05:00
|
|
|
|
|
|
|
return tempName
|
|
|
|
}
|