mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-02-22 07:50:04 -05:00
Add 'constellation config instance-types'
This commit is contained in:
parent
39eb58b403
commit
c0bfb9b61e
@ -14,6 +14,7 @@ func NewConfigCmd() *cobra.Command {
|
||||
|
||||
cmd.AddCommand(newConfigGenerateCmd())
|
||||
cmd.AddCommand(newConfigFetchMeasurementsCmd())
|
||||
cmd.AddCommand(NewConfigInstanceTypesCmd())
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
@ -63,6 +63,8 @@ func configGenerate(cmd *cobra.Command, fileHandler file.Handler, provider cloud
|
||||
}
|
||||
cmd.Println("Config file written to", flags.file)
|
||||
cmd.Println("Please fill in your CSP specific configuration before proceeding.")
|
||||
cmd.Println("You can find the list of supported virtual machine types by executing:")
|
||||
cmd.Println("\tconstellation config instance-types")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
35
cli/internal/cmd/configinstancetypes.go
Normal file
35
cli/internal/cmd/configinstancetypes.go
Normal file
@ -0,0 +1,35 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/edgelesssys/constellation/internal/config/instancetypes"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewConfigInstanceTypesCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "instance-types",
|
||||
Short: "Prints the supported instance types for all cloud providers",
|
||||
Long: "Prints the supported instance types for all cloud providers.",
|
||||
Args: cobra.ArbitraryArgs,
|
||||
Run: printSupportedInstanceTypes,
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func printSupportedInstanceTypes(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf(`Azure Confidential VM instance types:
|
||||
%v
|
||||
Azure Trusted Launch instance types:
|
||||
%v
|
||||
GCP instance types:
|
||||
%v
|
||||
`, formatInstanceTypes(instancetypes.AzureCVMInstanceTypes), formatInstanceTypes(instancetypes.AzureTrustedLaunchInstanceTypes), formatInstanceTypes(instancetypes.GCPInstanceTypes))
|
||||
}
|
||||
|
||||
func formatInstanceTypes(types []string) string {
|
||||
return "\t" + strings.Join(types, "\n\t")
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user