2022-09-05 09:06:08 +02:00
|
|
|
/*
|
|
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2022-03-22 16:03:15 +01:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2022-09-21 13:47:57 +02:00
|
|
|
"github.com/edgelesssys/constellation/v2/internal/cloud/cloudprovider"
|
2022-03-22 16:03:15 +01:00
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
2022-05-04 08:50:50 +02:00
|
|
|
func isCloudProvider(arg int) cobra.PositionalArgs {
|
2024-02-21 13:30:31 +01:00
|
|
|
return func(_ *cobra.Command, args []string) error {
|
2022-05-04 08:50:50 +02: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 16:03:15 +01:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|