mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
bd63aa3c6b
sed -i '1i/*\nCopyright (c) Edgeless Systems GmbH\n\nSPDX-License-Identifier: AGPL-3.0-only\n*/\n' `grep -rL --include='*.go' 'DO NOT EDIT'` gofumpt -w .
35 lines
842 B
Go
35 lines
842 B
Go
/*
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
|
|
"github.com/edgelesssys/constellation/internal/cloud/cloudprovider"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// warnAWS warns that AWS isn't supported.
|
|
func warnAWS(providerPos int) cobra.PositionalArgs {
|
|
return func(cmd *cobra.Command, args []string) error {
|
|
if cloudprovider.FromString(args[providerPos]) == cloudprovider.AWS {
|
|
return errors.New("AWS isn't supported by this version of Constellation")
|
|
}
|
|
return nil
|
|
}
|
|
}
|
|
|
|
func isCloudProvider(arg int) cobra.PositionalArgs {
|
|
return func(cmd *cobra.Command, args []string) error {
|
|
if provider := cloudprovider.FromString(args[arg]); provider == cloudprovider.Unknown {
|
|
return fmt.Errorf("argument %s isn't a valid cloud provider", args[arg])
|
|
}
|
|
return nil
|
|
}
|
|
}
|