Skip to content

Commit

Permalink
feat(remove): Update command from delete to remove (#58)
Browse files Browse the repository at this point in the history
* feat(remove): Update command from delete to remove

https://meroxa.atlassian.net/browse/PLATFORM-31

* Add backwards compatibility wiht destroy

Co-authored-by: Lyubo Kamenov <lyubo@meroxa.io>

* fix(create): Use better argument name

* fix(remove): Make acceptance tests to pass

* Update cmd/remove.go

Co-authored-by: Ali Hamidi <57750952+ahmeroxa@users.noreply.github.com>

* Update cmd/create.go

Co-authored-by: Ali Hamidi <57750952+ahmeroxa@users.noreply.github.com>

Co-authored-by: Lyubo Kamenov <lyubo@meroxa.io>
Co-authored-by: Ali Hamidi <57750952+ahmeroxa@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 18, 2021
1 parent 6719dfd commit 8bac37b
Show file tree
Hide file tree
Showing 29 changed files with 154 additions and 47 deletions.
4 changes: 2 additions & 2 deletions cmd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ including Connectors.`,
}

var createConnectorCmd = &cobra.Command{
Use: "connector <custom-connector-name>",
Use: "connector <resource-name>",
Short: "Create a connector",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return errors.New("requires a connector name\n\nUsage:\n meroxa create connector <custom-connector-name> [flags]")
return errors.New("requires a resource name\n\nUsage:\n meroxa create connector <resource-name> [flags]")
}

// Resource Name
Expand Down
43 changes: 23 additions & 20 deletions cmd/delete.go → cmd/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@ import (
"time"
)

// deleteCmd represents the delete command
var deleteCmd = &cobra.Command{
Use: "delete",
Short: "Delete a component",
// removeCmd represents the remove command
var removeCmd = &cobra.Command{
Use: "remove",
Short: "Remove a component",
Long: `Deprovision a component of the Meroxa platform, including pipelines,
resources, connectors, functions, etc...`,
resources, and connectors`,
SuggestFor: []string{"destroy", "delete"},
Aliases: []string{"rm", "delete"},
}

var deleteResourceCmd = &cobra.Command{
var removeResourceCmd = &cobra.Command{
Use: "resource <name>",
Short: "Delete resource",
Short: "Remove resource",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return errors.New("requires resource name\n\nUsage:\n meroxa delete resource <name>")
return errors.New("requires resource name\n\nUsage:\n meroxa remove resource <name>")
}
// Resource Name
resName := args[0]
Expand Down Expand Up @@ -66,6 +68,7 @@ var deleteResourceCmd = &cobra.Command{
ctx, cancel = context.WithTimeout(ctx, 5*time.Second)
defer cancel()

// TODO: Update meroxa-go to `RemoveResource` to match its implementation
err = c.DeleteResource(ctx, res.ID)
if err != nil {
return err
Expand All @@ -76,12 +79,12 @@ var deleteResourceCmd = &cobra.Command{
},
}

var deleteConnectorCmd = &cobra.Command{
var removeConnectorCmd = &cobra.Command{
Use: "connector <name>",
Short: "Delete connector",
Short: "Remove connector",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return errors.New("requires connector name\n\nUsage:\n meroxa delete connector <name>")
return errors.New("requires connector name\n\nUsage:\n meroxa remove connector <name>")
}

// Connector Name
Expand Down Expand Up @@ -116,17 +119,17 @@ var deleteConnectorCmd = &cobra.Command{
return err
}

display.PrettyPrint("connector deleted", con)
display.PrettyPrint("connector removed", con)
return nil
},
}

var deletePipelineCmd = &cobra.Command{
var removePipelineCmd = &cobra.Command{
Use: "pipeline <name>",
Short: "Delete pipeline",
Short: "Remove pipeline",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return errors.New("requires pipeline name\n\nUsage:\n meroxa delete pipeline <name>")
return errors.New("requires pipeline name\n\nUsage:\n meroxa remove pipeline <name>")
}

// Pipeline Name
Expand Down Expand Up @@ -161,16 +164,16 @@ var deletePipelineCmd = &cobra.Command{
return err
}

display.PrettyPrint("Pipeline deleted", pipeline)
display.PrettyPrint("Pipeline removed", pipeline)
return nil
},
}

func init() {
RootCmd.AddCommand(deleteCmd)
RootCmd.AddCommand(removeCmd)

// Subcommands
deleteCmd.AddCommand(deleteResourceCmd)
deleteCmd.AddCommand(deleteConnectorCmd)
deleteCmd.AddCommand(deletePipelineCmd)
removeCmd.AddCommand(removeResourceCmd)
removeCmd.AddCommand(removeConnectorCmd)
removeCmd.AddCommand(removePipelineCmd)
}
4 changes: 2 additions & 2 deletions docs/commands/meroxa.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ meroxa list resource-types
* [meroxa completion](meroxa_completion.md) - Generate completion script
* [meroxa connect](meroxa_connect.md) - Connect two resources together
* [meroxa create](meroxa_create.md) - Create meroxa pipeline components
* [meroxa delete](meroxa_delete.md) - Delete a component
* [meroxa describe](meroxa_describe.md) - Describe a component
* [meroxa list](meroxa_list.md) - List components
* [meroxa login](meroxa_login.md) - Log into the Meroxa platform
* [meroxa logout](meroxa_logout.md) - Logout of the Meroxa platform
* [meroxa logs](meroxa_logs.md) - Print logs for a component
* [meroxa remove](meroxa_remove.md) - Remove a component
* [meroxa signup](meroxa_signup.md) - Sign up to the Meroxa platform
* [meroxa version](meroxa_version.md) - Display the Meroxa CLI version

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_add.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Use the add command to add various Meroxa resources to your account.
* [meroxa](meroxa.md) - The Meroxa CLI
* [meroxa add resource](meroxa_add_resource.md) - Add a resource to your account

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_add_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ meroxa add resource <resource-type> [flags]

* [meroxa add](meroxa_add.md) - Add a Meroxa resource

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ meroxa completion [bash|zsh|fish|powershell]

* [meroxa](meroxa.md) - The Meroxa CLI

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ meroxa connect --from <resource-name> --to <resource-name> [flags]

* [meroxa](meroxa.md) - The Meroxa CLI

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ including Connectors.
* [meroxa create connector](meroxa_create_connector.md) - Create a connector
* [meroxa create pipeline](meroxa_create_pipeline.md) - Create a pipeline

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
4 changes: 2 additions & 2 deletions docs/commands/meroxa_create_connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Create a connector

```
meroxa create connector <custom-connector-name> [flags]
meroxa create connector <resource-name> [flags]
```

### Options
Expand All @@ -26,4 +26,4 @@ meroxa create connector <custom-connector-name> [flags]

* [meroxa create](meroxa_create.md) - Create meroxa pipeline components

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_create_pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ meroxa create pipeline <name> [flags]

* [meroxa create](meroxa_create.md) - Create meroxa pipeline components

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_describe.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Describe a component of the Meroxa data platform, including resources and connec
* [meroxa describe connector](meroxa_describe_connector.md) - Describe connector
* [meroxa describe resource](meroxa_describe_resource.md) - Describe resource

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_describe_connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ meroxa describe connector [name] [flags]

* [meroxa describe](meroxa_describe.md) - Describe a component

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_describe_resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ meroxa describe resource <name> [flags]

* [meroxa describe](meroxa_describe.md) - Describe a component

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ List the components of the Meroxa platform, including pipelines,
* [meroxa list resource-types](meroxa_list_resource-types.md) - List resources-types
* [meroxa list resources](meroxa_list_resources.md) - List resources

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_list_connectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ meroxa list connectors [flags]

* [meroxa list](meroxa_list.md) - List components

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_list_pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ meroxa list pipelines [flags]

* [meroxa list](meroxa_list.md) - List components

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_list_resource-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ meroxa list resource-types [flags]

* [meroxa list](meroxa_list.md) - List components

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_list_resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ meroxa list resources [flags]

* [meroxa list](meroxa_list.md) - List components

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_login.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ meroxa login [flags]
* [meroxa](meroxa.md) - The Meroxa CLI
* [meroxa login whoami](meroxa_login_whoami.md) - Display effective username

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_login_whoami.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ meroxa login whoami [flags]

* [meroxa login](meroxa_login.md) - Log into the Meroxa platform

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_logout.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ meroxa logout [flags]

* [meroxa](meroxa.md) - The Meroxa CLI

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ Print logs for a component
* [meroxa](meroxa.md) - The Meroxa CLI
* [meroxa logs connector](meroxa_logs_connector.md) - Print logs for a connector

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_logs_connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ meroxa logs connector <name> [flags]

* [meroxa logs](meroxa_logs.md) - Print logs for a component

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
29 changes: 29 additions & 0 deletions docs/commands/meroxa_remove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## meroxa remove

Remove a component

### Synopsis

Deprovision a component of the Meroxa platform, including pipelines,
resources, and connectors

### Options

```
-h, --help help for remove
```

### Options inherited from parent commands

```
--json output json
```

### SEE ALSO

* [meroxa](meroxa.md) - The Meroxa CLI
* [meroxa remove connector](meroxa_remove_connector.md) - Remove connector
* [meroxa remove pipeline](meroxa_remove_pipeline.md) - Remove pipeline
* [meroxa remove resource](meroxa_remove_resource.md) - Remove resource

###### Auto generated by spf13/cobra on 17-Feb-2021
25 changes: 25 additions & 0 deletions docs/commands/meroxa_remove_connector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## meroxa remove connector

Remove connector

```
meroxa remove connector <name> [flags]
```

### Options

```
-h, --help help for connector
```

### Options inherited from parent commands

```
--json output json
```

### SEE ALSO

* [meroxa remove](meroxa_remove.md) - Remove a component

###### Auto generated by spf13/cobra on 17-Feb-2021
25 changes: 25 additions & 0 deletions docs/commands/meroxa_remove_pipeline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## meroxa remove pipeline

Remove pipeline

```
meroxa remove pipeline <name> [flags]
```

### Options

```
-h, --help help for pipeline
```

### Options inherited from parent commands

```
--json output json
```

### SEE ALSO

* [meroxa remove](meroxa_remove.md) - Remove a component

###### Auto generated by spf13/cobra on 17-Feb-2021
25 changes: 25 additions & 0 deletions docs/commands/meroxa_remove_resource.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## meroxa remove resource

Remove resource

```
meroxa remove resource <name> [flags]
```

### Options

```
-h, --help help for resource
```

### Options inherited from parent commands

```
--json output json
```

### SEE ALSO

* [meroxa remove](meroxa_remove.md) - Remove a component

###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_signup.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ meroxa signup [flags]

* [meroxa](meroxa.md) - The Meroxa CLI

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021
2 changes: 1 addition & 1 deletion docs/commands/meroxa_version.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ meroxa version [flags]

* [meroxa](meroxa.md) - The Meroxa CLI

###### Auto generated by spf13/cobra on 15-Feb-2021
###### Auto generated by spf13/cobra on 17-Feb-2021

0 comments on commit 8bac37b

Please sign in to comment.