You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
packer/provisioner/powershell/execution_policy.go

32 lines
768 B

//go:generate enumer -transform snake -trimprefix ExecutionPolicy -type ExecutionPolicy
package powershell
import (
"reflect"
)
// ExecutionPolicy setting to run the command(s).
// For the powershell provider the default has historically been to bypass.
type ExecutionPolicy int
const (
ExecutionPolicyBypass ExecutionPolicy = iota
ExecutionPolicyAllsigned
ExecutionPolicyDefault
ExecutionPolicyRemotesigned
ExecutionPolicyRestricted
ExecutionPolicyUndefined
ExecutionPolicyUnrestricted
ExecutionPolicyNone // not set
)
func StringToExecutionPolicyHook(f reflect.Kind, t reflect.Kind, data interface{}) (interface{}, error) {
if f != reflect.String || t != reflect.Int {
return data, nil
}
raw := data.(string)
return ExecutionPolicyString(raw)
}