constellation/cli/cloudprovider/cloudprovider.go

31 lines
444 B
Go
Raw Normal View History

package cloudprovider
2022-04-13 07:01:38 -04:00
import "strings"
//go:generate stringer -type=CloudProvider
2022-04-13 09:09:33 -04:00
// Provider is cloud provider used by the CLI.
type Provider uint32
const (
2022-04-13 09:09:33 -04:00
Unknown Provider = iota
AWS
Azure
GCP
)
2022-04-13 07:01:38 -04:00
// FromString returns cloud provider from string.
2022-04-13 09:09:33 -04:00
func FromString(s string) Provider {
2022-04-13 07:01:38 -04:00
s = strings.ToLower(s)
switch s {
case "aws":
return AWS
case "azure":
return Azure
case "gcp":
return GCP
default:
return Unknown
}
}