Move cli/cloudprovider into internal/cloud

This commit is contained in:
katexochen 2022-06-07 11:08:44 +02:00 committed by Paul Meyer
parent aee4d44b45
commit 67b25d2771
33 changed files with 31 additions and 31 deletions

View file

@ -0,0 +1,33 @@
package cloudprovider
import "strings"
//go:generate stringer -type=Provider
// Provider is cloud provider used by the CLI.
type Provider uint32
const (
Unknown Provider = iota
AWS
Azure
GCP
QEMU
)
// FromString returns cloud provider from string.
func FromString(s string) Provider {
s = strings.ToLower(s)
switch s {
case "aws":
return AWS
case "azure":
return Azure
case "gcp":
return GCP
case "qemu":
return QEMU
default:
return Unknown
}
}

View file

@ -0,0 +1,27 @@
// Code generated by "stringer -type=Provider"; DO NOT EDIT.
package cloudprovider
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[Unknown-0]
_ = x[AWS-1]
_ = x[Azure-2]
_ = x[GCP-3]
_ = x[QEMU-4]
}
const _Provider_name = "UnknownAWSAzureGCPQEMU"
var _Provider_index = [...]uint8{0, 7, 10, 15, 18, 22}
func (i Provider) String() string {
if i >= Provider(len(_Provider_index)-1) {
return "Provider(" + strconv.FormatInt(int64(i), 10) + ")"
}
return _Provider_name[_Provider_index[i]:_Provider_index[i+1]]
}

View file

@ -8,7 +8,7 @@ import (
"fmt"
"io/fs"
"github.com/edgelesssys/constellation/cli/cloudprovider"
"github.com/edgelesssys/constellation/internal/cloud/cloudprovider"
"github.com/edgelesssys/constellation/internal/constants"
"github.com/edgelesssys/constellation/internal/file"
"github.com/go-playground/locales/en"

View file

@ -3,7 +3,7 @@ package config
import (
"testing"
"github.com/edgelesssys/constellation/cli/cloudprovider"
"github.com/edgelesssys/constellation/internal/cloud/cloudprovider"
"github.com/edgelesssys/constellation/internal/constants"
"github.com/edgelesssys/constellation/internal/file"
"github.com/spf13/afero"