Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ ABCTL_VERSION?=dev
build:
CGO_ENABLED=0 go build -trimpath -o build/ -ldflags "-w -X github.com/airbytehq/abctl/internal/build.Version=$(ABCTL_VERSION)" .

.PHONY: build-new
build-new:
CGO_ENABLED=0 go build -tags newcli -trimpath -o build/abctl-new -ldflags "-w -X github.com/airbytehq/abctl/internal/build.Version=$(ABCTL_VERSION)" main_new.go

.PHONY: clean
clean:
rm -rf build/
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,3 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.4.3 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

tool go.uber.org/mock/mockgen
35 changes: 35 additions & 0 deletions internal/cmd/cmd_new.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package cmd

import (
"context"

"github.com/airbytehq/abctl/internal/cmd/verbs"
"github.com/airbytehq/abctl/internal/k8s"
"github.com/airbytehq/abctl/internal/service"
"github.com/alecthomas/kong"
"github.com/pterm/pterm"
)

type verboseNew bool

func (v verboseNew) BeforeApply() error {
pterm.EnableDebugMessages()
return nil
}

type CmdNew struct {
Get verbs.GetCmd `cmd:"" help:"Get resource information."`
List verbs.ListCmd `cmd:"" help:"List resources."`
Create verbs.CreateCmd `cmd:"" help:"Create resources."`
Edit verbs.EditCmd `cmd:"" help:"Edit resources."`
Delete verbs.DeleteCmd `cmd:"" help:"Delete resources."`
Logs verbs.LogsCmd `cmd:"" help:"View resource logs."`

Verbose verboseNew `short:"v" help:"Enable verbose output."`
}

func (c *CmdNew) BeforeApply(_ context.Context, kCtx *kong.Context) error {
kCtx.BindTo(k8s.DefaultProvider, (*k8s.Provider)(nil))
kCtx.BindTo(service.DefaultManagerClientFactory, (*service.ManagerClientFactory)(nil))
return nil
}
19 changes: 19 additions & 0 deletions internal/cmd/verbs/create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package verbs

import (
"github.com/airbytehq/abctl/internal/nouns/airbyte"
"github.com/airbytehq/abctl/internal/nouns/dataplane"
"github.com/airbytehq/abctl/internal/nouns/region"
"github.com/airbytehq/abctl/internal/nouns/workspace"
)

type CreateCmd struct {
Airbyte airbyte.Creator `cmd:"" help:"Create local Airbyte installation."`
Airbytes airbyte.Creator `cmd:"airbytes" aliases:"airbytes" help:"Create local Airbyte installation (plural)."`
Dataplane dataplane.Creator `cmd:"" help:"Create dataplane."`
Dataplanes dataplane.Creator `cmd:"dataplanes" aliases:"dataplanes" help:"Create dataplane (plural)."`
Region region.Creator `cmd:"" help:"Create region."`
Regions region.Creator `cmd:"regions" aliases:"regions" help:"Create region (plural)."`
Workspace workspace.Creator `cmd:"" help:"Create workspace."`
Workspaces workspace.Creator `cmd:"workspaces" aliases:"workspaces" help:"Create workspace (plural)."`
}
19 changes: 19 additions & 0 deletions internal/cmd/verbs/delete.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package verbs

import (
"github.com/airbytehq/abctl/internal/nouns/airbyte"
"github.com/airbytehq/abctl/internal/nouns/dataplane"
"github.com/airbytehq/abctl/internal/nouns/region"
"github.com/airbytehq/abctl/internal/nouns/workspace"
)

type DeleteCmd struct {
Airbyte airbyte.Deleter `cmd:"" help:"Delete Airbyte installation."`
Airbytes airbyte.Deleter `cmd:"airbytes" aliases:"airbytes" help:"Delete Airbyte installation (plural)."`
Dataplane dataplane.Deleter `cmd:"" help:"Delete dataplane."`
Dataplanes dataplane.Deleter `cmd:"dataplanes" aliases:"dataplanes" help:"Delete dataplane (plural)."`
Region region.Deleter `cmd:"" help:"Delete region."`
Regions region.Deleter `cmd:"regions" aliases:"regions" help:"Delete region (plural)."`
Workspace workspace.Deleter `cmd:"" help:"Delete workspace."`
Workspaces workspace.Deleter `cmd:"workspaces" aliases:"workspaces" help:"Delete workspace (plural)."`
}
19 changes: 19 additions & 0 deletions internal/cmd/verbs/edit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package verbs

import (
"github.com/airbytehq/abctl/internal/nouns/airbyte"
"github.com/airbytehq/abctl/internal/nouns/dataplane"
"github.com/airbytehq/abctl/internal/nouns/region"
"github.com/airbytehq/abctl/internal/nouns/workspace"
)

type EditCmd struct {
Airbyte airbyte.Editor `cmd:"" help:"Edit Airbyte configuration."`
Airbytes airbyte.Editor `cmd:"airbytes" aliases:"airbytes" help:"Edit Airbyte configuration (plural)."`
Dataplane dataplane.Editor `cmd:"" help:"Edit dataplane configuration."`
Dataplanes dataplane.Editor `cmd:"dataplanes" aliases:"dataplanes" help:"Edit dataplane configuration (plural)."`
Region region.Editor `cmd:"" help:"Edit region configuration."`
Regions region.Editor `cmd:"regions" aliases:"regions" help:"Edit region configuration (plural)."`
Workspace workspace.Editor `cmd:"" help:"Edit workspace configuration."`
Workspaces workspace.Editor `cmd:"workspaces" aliases:"workspaces" help:"Edit workspace configuration (plural)."`
}
19 changes: 19 additions & 0 deletions internal/cmd/verbs/get.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package verbs

import (
"github.com/airbytehq/abctl/internal/nouns/airbyte"
"github.com/airbytehq/abctl/internal/nouns/dataplane"
"github.com/airbytehq/abctl/internal/nouns/region"
"github.com/airbytehq/abctl/internal/nouns/workspace"
)

type GetCmd struct {
Airbyte airbyte.Getter `cmd:"" help:"Get Airbyte information."`
Airbytes airbyte.Getter `cmd:"airbytes" aliases:"airbytes" help:"Get Airbyte information (plural)."`
Dataplane dataplane.Getter `cmd:"" help:"Get dataplane information."`
Dataplanes dataplane.Getter `cmd:"dataplanes" aliases:"dataplanes" help:"Get dataplane information (plural)."`
Region region.Getter `cmd:"" help:"Get region information."`
Regions region.Getter `cmd:"regions" aliases:"regions" help:"Get region information (plural)."`
Workspace workspace.Getter `cmd:"" help:"Get workspace information."`
Workspaces workspace.Getter `cmd:"workspaces" aliases:"workspaces" help:"Get workspace information (plural)."`
}
19 changes: 19 additions & 0 deletions internal/cmd/verbs/list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package verbs

import (
"github.com/airbytehq/abctl/internal/nouns/airbyte"
"github.com/airbytehq/abctl/internal/nouns/dataplane"
"github.com/airbytehq/abctl/internal/nouns/region"
"github.com/airbytehq/abctl/internal/nouns/workspace"
)

type ListCmd struct {
Airbyte airbyte.Lister `cmd:"" help:"List Airbyte deployments."`
Airbytes airbyte.Lister `cmd:"airbytes" aliases:"airbytes" help:"List Airbyte deployments (plural)."`
Dataplane dataplane.Lister `cmd:"" help:"List dataplanes."`
Dataplanes dataplane.Lister `cmd:"dataplanes" aliases:"dataplanes" help:"List dataplanes (plural)."`
Region region.Lister `cmd:"" help:"List regions."`
Regions region.Lister `cmd:"regions" aliases:"regions" help:"List regions (plural)."`
Workspace workspace.Lister `cmd:"" help:"List workspaces."`
Workspaces workspace.Lister `cmd:"workspaces" aliases:"workspaces" help:"List workspaces (plural)."`
}
19 changes: 19 additions & 0 deletions internal/cmd/verbs/logs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package verbs

import (
"github.com/airbytehq/abctl/internal/nouns/airbyte"
"github.com/airbytehq/abctl/internal/nouns/dataplane"
"github.com/airbytehq/abctl/internal/nouns/region"
"github.com/airbytehq/abctl/internal/nouns/workspace"
)

type LogsCmd struct {
Airbyte airbyte.Logger `cmd:"" help:"View Airbyte logs."`
Airbytes airbyte.Logger `cmd:"airbytes" aliases:"airbytes" help:"View Airbyte logs (plural)."`
Dataplane dataplane.Logger `cmd:"" help:"View dataplane logs."`
Dataplanes dataplane.Logger `cmd:"dataplanes" aliases:"dataplanes" help:"View dataplane logs (plural)."`
Region region.Logger `cmd:"" help:"View region logs."`
Regions region.Logger `cmd:"regions" aliases:"regions" help:"View region logs (plural)."`
Workspace workspace.Logger `cmd:"" help:"View workspace logs."`
Workspaces workspace.Logger `cmd:"workspaces" aliases:"workspaces" help:"View workspace logs (plural)."`
}
Loading
Loading