diff --git a/commands/namespace_delete.go b/commands/namespace_remove.go similarity index 57% rename from commands/namespace_delete.go rename to commands/namespace_remove.go index 3306a029..2226c4ae 100644 --- a/commands/namespace_delete.go +++ b/commands/namespace_remove.go @@ -10,20 +10,21 @@ import ( "github.com/spf13/cobra" ) -var namespaceDeleteCmd = &cobra.Command{ - Use: `delete NAME`, - Short: "Delete existing namespace", - Long: "Delete existing namespace", - Example: ` faas-cli namespace delete NAME`, - RunE: deleteNamespace, - PreRunE: preDeleteNamespace, +var namespaceRemoveCmd = &cobra.Command{ + Use: `remove NAME`, + Short: "Remove existing namespace", + Long: "Remove existing namespace", + Example: ` faas-cli namespace remove NAME`, + Aliases: []string{"rm", "delete"}, + RunE: removeNamespace, + PreRunE: preRemoveNamespace, } func init() { - namespaceCmd.AddCommand(namespaceDeleteCmd) + namespaceCmd.AddCommand(namespaceRemoveCmd) } -func preDeleteNamespace(cmd *cobra.Command, args []string) error { +func preRemoveNamespace(cmd *cobra.Command, args []string) error { if len(args) == 0 { return fmt.Errorf("namespace name required") } @@ -35,7 +36,7 @@ func preDeleteNamespace(cmd *cobra.Command, args []string) error { return nil } -func deleteNamespace(cmd *cobra.Command, args []string) error { +func removeNamespace(cmd *cobra.Command, args []string) error { client, err := GetDefaultSDKClient() if err != nil { return err @@ -48,7 +49,7 @@ func deleteNamespace(cmd *cobra.Command, args []string) error { return err } - fmt.Printf("Namespace Deleted: %s\n", ns) + fmt.Printf("Namespace Removed: %s\n", ns) return nil } diff --git a/commands/namespace_delete_test.go b/commands/namespace_remove_test.go similarity index 82% rename from commands/namespace_delete_test.go rename to commands/namespace_remove_test.go index bb3838d8..5bbcd390 100644 --- a/commands/namespace_delete_test.go +++ b/commands/namespace_remove_test.go @@ -3,7 +3,7 @@ package commands import "testing" func Test_preDeleteNamespace_NoArgs_Fails(t *testing.T) { - res := preDeleteNamespace(nil, []string{}) + res := preRemoveNamespace(nil, []string{}) want := "namespace name required" if res.Error() != want { @@ -12,7 +12,7 @@ func Test_preDeleteNamespace_NoArgs_Fails(t *testing.T) { } func Test_preDeleteNamespace_MoreThan1Arg_Fails(t *testing.T) { - res := preDeleteNamespace(nil, []string{ + res := preRemoveNamespace(nil, []string{ "secret1", "secret2", }) @@ -24,7 +24,7 @@ func Test_preDeleteNamespace_MoreThan1Arg_Fails(t *testing.T) { } func Test_preDeleteNamespace_ExtactlyOneArgIsFine(t *testing.T) { - res := preDeleteNamespace(nil, []string{ + res := preRemoveNamespace(nil, []string{ "namespace1", }) diff --git a/commands/secret_remove.go b/commands/secret_remove.go index be8a4ed2..1f33925d 100644 --- a/commands/secret_remove.go +++ b/commands/secret_remove.go @@ -15,7 +15,7 @@ import ( var secretRemoveCmd = &cobra.Command{ Use: "remove [--tls-no-verify]", - Aliases: []string{"rm"}, + Aliases: []string{"rm", "delete"}, Short: "remove a secret", Long: `Remove a secret by name`, Example: `faas-cli secret remove NAME diff --git a/schema/openfaas/v1alpha2/crd.go b/schema/openfaas/v1alpha2/crd.go deleted file mode 100644 index 62d6f041..00000000 --- a/schema/openfaas/v1alpha2/crd.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) OpenFaaS Author(s) 2018. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -package v1 - -import ( - "github.com/openfaas/faas-cli/schema" - "github.com/openfaas/faas-cli/stack" -) - -// APIVersionLatest latest API version of CRD -const APIVersionLatest = "openfaas.com/v1" - -// Spec describe characteristics of the object -type Spec struct { - //Name name of the function - Name string `yaml:"name"` - //Image docker image name of the function - Image string `yaml:"image"` - - Environment map[string]string `yaml:"environment,omitempty"` - - Labels *map[string]string `yaml:"labels,omitempty"` - - //Limits for the function - Limits *stack.FunctionResources `yaml:"limits,omitempty"` - - //Requests of resources requested by function - Requests *stack.FunctionResources `yaml:"requests,omitempty"` - - Constraints *[]string `yaml:"constraints,omitempty"` - - //Secrets list of secrets to be made available to function - Secrets []string `yaml:"secrets,omitempty"` -} - -// CRD root level YAML definition for the object -type CRD struct { - //APIVersion CRD API version - APIVersion string `yaml:"apiVersion"` - //Kind kind of the object - Kind string `yaml:"kind"` - Metadata schema.Metadata `yaml:"metadata"` - Spec Spec `yaml:"spec"` -}