2022-09-05 03:06:08 -04:00
|
|
|
/*
|
|
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2022-03-22 11:03:15 -04:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
2022-04-13 07:01:38 -04:00
|
|
|
"errors"
|
2022-03-22 11:03:15 -04:00
|
|
|
"fmt"
|
|
|
|
|
2022-06-07 05:08:44 -04:00
|
|
|
"github.com/edgelesssys/constellation/internal/cloud/cloudprovider"
|
2022-03-22 11:03:15 -04:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2022-04-13 07:01:38 -04:00
|
|
|
// warnAWS warns that AWS isn't supported.
|
|
|
|
func warnAWS(providerPos int) cobra.PositionalArgs {
|
2022-04-04 09:55:58 -04:00
|
|
|
return func(cmd *cobra.Command, args []string) error {
|
2022-04-13 07:01:38 -04:00
|
|
|
if cloudprovider.FromString(args[providerPos]) == cloudprovider.AWS {
|
2022-05-13 05:29:41 -04:00
|
|
|
return errors.New("AWS isn't supported by this version of Constellation")
|
2022-04-04 10:44:15 -04:00
|
|
|
}
|
|
|
|
return nil
|
2022-04-04 09:55:58 -04:00
|
|
|
}
|
2022-04-04 10:44:15 -04:00
|
|
|
}
|
|
|
|
|
2022-05-04 02:50:50 -04:00
|
|
|
func isCloudProvider(arg int) cobra.PositionalArgs {
|
2022-03-22 11:03:15 -04:00
|
|
|
return func(cmd *cobra.Command, args []string) error {
|
2022-05-04 02:50:50 -04:00
|
|
|
if provider := cloudprovider.FromString(args[arg]); provider == cloudprovider.Unknown {
|
|
|
|
return fmt.Errorf("argument %s isn't a valid cloud provider", args[arg])
|
2022-03-22 11:03:15 -04:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|