mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-11-13 00:50:38 -05:00
Move cli/cloudprovider into internal/cloud
This commit is contained in:
parent
aee4d44b45
commit
67b25d2771
33 changed files with 31 additions and 31 deletions
33
internal/cloud/cloudprovider/cloudprovider.go
Normal file
33
internal/cloud/cloudprovider/cloudprovider.go
Normal 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
|
||||
}
|
||||
}
|
||||
27
internal/cloud/cloudprovider/provider_string.go
Normal file
27
internal/cloud/cloudprovider/provider_string.go
Normal 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]]
|
||||
}
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue