Skip to content

Commit b93b3d8

Browse files
committed
align function/type names with command structure
1 parent b79a27a commit b93b3d8

15 files changed

+58
-58
lines changed

internal/cmd/catalog_add.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
func newCatalogAddCmd(cfg *action.Configuration) *cobra.Command {
16-
a := action.NewAddCatalog(cfg)
16+
a := action.NewCatalogAdd(cfg)
1717

1818
cmd := &cobra.Command{
1919
Use: "add <name> <index_image>",

internal/cmd/catalog_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
func newCatalogListCmd(cfg *action.Configuration) *cobra.Command {
1818
var allNamespaces bool
19-
l := action.NewListCatalogs(cfg)
19+
l := action.NewCatalogList(cfg)
2020
cmd := &cobra.Command{
2121
Use: "list",
2222
Short: "List installed operator catalogs",

internal/cmd/catalog_remove.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
func newCatalogRemoveCmd(cfg *action.Configuration) *cobra.Command {
11-
u := action.NewRemoveCatalog(cfg)
11+
u := action.NewCatalogRemove(cfg)
1212
cmd := &cobra.Command{
1313
Use: "remove <catalog_name>",
1414
Short: "Remove a operator catalog",

internal/cmd/operator_install.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"github.com/joelanford/kubectl-operator/internal/pkg/log"
1010
)
1111

12-
func newInstallCmd(cfg *action.Configuration) *cobra.Command {
13-
i := action.NewInstallOperator(cfg)
12+
func newOperatorInstallCmd(cfg *action.Configuration) *cobra.Command {
13+
i := action.NewOperatorInstall(cfg)
1414
cmd := &cobra.Command{
1515
Use: "install <operator>",
1616
Short: "Install an operator",

internal/cmd/operator_list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ import (
1616
"github.com/joelanford/kubectl-operator/internal/pkg/log"
1717
)
1818

19-
func newListCmd(cfg *action.Configuration) *cobra.Command {
19+
func newOperatorListCmd(cfg *action.Configuration) *cobra.Command {
2020
var allNamespaces bool
21-
l := action.NewListOperators(cfg)
21+
l := action.NewOperatorList(cfg)
2222
cmd := &cobra.Command{
2323
Use: "list",
2424
Short: "List installed operators",

internal/cmd/operator_list_available.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import (
1616
"github.com/joelanford/kubectl-operator/internal/pkg/log"
1717
)
1818

19-
func newListAvailableCmd(cfg *action.Configuration) *cobra.Command {
20-
l := action.NewListAvailableOperators(cfg)
19+
func newOperatorListAvailableCmd(cfg *action.Configuration) *cobra.Command {
20+
l := action.NewOperatorListAvailable(cfg)
2121
cmd := &cobra.Command{
2222
Use: "list-available",
2323
Short: "List operators available to be installed",

internal/cmd/operator_uninstall.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"github.com/joelanford/kubectl-operator/internal/pkg/log"
88
)
99

10-
func newUninstallCmd(cfg *action.Configuration) *cobra.Command {
11-
u := action.NewUninstallOperator(cfg)
10+
func newOperatorUninstallCmd(cfg *action.Configuration) *cobra.Command {
11+
u := action.NewOperatorUninstall(cfg)
1212
cmd := &cobra.Command{
1313
Use: "uninstall <operator>",
1414
Short: "Uninstall an operator",

internal/cmd/root.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ operators from the installed catalogs.`,
2929

3030
cmd.AddCommand(
3131
newCatalogCmd(&cfg),
32-
newInstallCmd(&cfg),
33-
newUninstallCmd(&cfg),
34-
newListCmd(&cfg),
35-
newListAvailableCmd(&cfg),
32+
newOperatorInstallCmd(&cfg),
33+
newOperatorUninstallCmd(&cfg),
34+
newOperatorListCmd(&cfg),
35+
newOperatorListAvailableCmd(&cfg),
3636
)
3737

3838
return cmd

internal/pkg/action/catalog_add.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/joelanford/kubectl-operator/internal/pkg/log"
1818
)
1919

20-
type AddCatalog struct {
20+
type CatalogAdd struct {
2121
config *Configuration
2222

2323
CatalogSourceName string
@@ -32,20 +32,20 @@ type AddCatalog struct {
3232
registry *containerdregistry.Registry
3333
}
3434

35-
func NewAddCatalog(cfg *Configuration) *AddCatalog {
36-
return &AddCatalog{
35+
func NewCatalogAdd(cfg *Configuration) *CatalogAdd {
36+
return &CatalogAdd{
3737
config: cfg,
3838
}
3939
}
4040

41-
func (a *AddCatalog) BindFlags(fs *pflag.FlagSet) {
41+
func (a *CatalogAdd) BindFlags(fs *pflag.FlagSet) {
4242
fs.StringVarP(&a.DisplayName, "display-name", "d", "", "display name of the index")
4343
fs.StringVarP(&a.Publisher, "publisher", "p", "", "publisher of the index")
4444
fs.DurationVarP(&a.AddTimeout, "timeout", "t", time.Minute, "the amount of time to wait before cancelling the catalog addition")
4545
fs.DurationVar(&a.CleanupTimeout, "cleanup-timeout", time.Minute, "the amount to time to wait before cancelling cleanup")
4646
}
4747

48-
func (a *AddCatalog) Run(ctx context.Context) (*v1alpha1.CatalogSource, error) {
48+
func (a *CatalogAdd) Run(ctx context.Context) (*v1alpha1.CatalogSource, error) {
4949
var err error
5050
a.registry, err = containerdregistry.NewRegistry(a.RegistryOptions...)
5151
if err != nil {
@@ -83,7 +83,7 @@ func (a *AddCatalog) Run(ctx context.Context) (*v1alpha1.CatalogSource, error) {
8383
return cs, nil
8484
}
8585

86-
func (a *AddCatalog) labelsFor(ctx context.Context, indexImage string) (map[string]string, error) {
86+
func (a *CatalogAdd) labelsFor(ctx context.Context, indexImage string) (map[string]string, error) {
8787
simpleRef := image.SimpleReference(indexImage)
8888
if err := a.registry.Pull(ctx, simpleRef); err != nil {
8989
return nil, fmt.Errorf("pull image: %v", err)
@@ -95,7 +95,7 @@ func (a *AddCatalog) labelsFor(ctx context.Context, indexImage string) (map[stri
9595
return labels, nil
9696
}
9797

98-
func (a *AddCatalog) setDefaults(labels map[string]string) {
98+
func (a *CatalogAdd) setDefaults(labels map[string]string) {
9999
if a.DisplayName == "" {
100100
if v, ok := labels["operators.operatorframework.io.index.display-name"]; ok {
101101
a.DisplayName = v
@@ -108,7 +108,7 @@ func (a *AddCatalog) setDefaults(labels map[string]string) {
108108
}
109109
}
110110

111-
func (a *AddCatalog) add(ctx context.Context, cs *v1alpha1.CatalogSource) error {
111+
func (a *CatalogAdd) add(ctx context.Context, cs *v1alpha1.CatalogSource) error {
112112
if err := a.config.Client.Create(ctx, cs); err != nil {
113113
return fmt.Errorf("create catalogsource: %v", err)
114114
}
@@ -133,7 +133,7 @@ func (a *AddCatalog) add(ctx context.Context, cs *v1alpha1.CatalogSource) error
133133
return nil
134134
}
135135

136-
func (a *AddCatalog) cleanup(cs *v1alpha1.CatalogSource) {
136+
func (a *CatalogAdd) cleanup(cs *v1alpha1.CatalogSource) {
137137
ctx, cancel := context.WithTimeout(context.Background(), a.CleanupTimeout)
138138
defer cancel()
139139
if err := a.config.Client.Delete(ctx, cs); err != nil {

internal/pkg/action/catalog_list.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import (
77
"sigs.k8s.io/controller-runtime/pkg/client"
88
)
99

10-
type ListCatalogs struct {
10+
type CatalogList struct {
1111
config *Configuration
1212
}
1313

14-
func NewListCatalogs(cfg *Configuration) *ListCatalogs {
15-
return &ListCatalogs{cfg}
14+
func NewCatalogList(cfg *Configuration) *CatalogList {
15+
return &CatalogList{cfg}
1616
}
1717

18-
func (l *ListCatalogs) Run(ctx context.Context) ([]v1alpha1.CatalogSource, error) {
18+
func (l *CatalogList) Run(ctx context.Context) ([]v1alpha1.CatalogSource, error) {
1919
css := v1alpha1.CatalogSourceList{}
2020
if err := l.config.Client.List(ctx, &css, client.InNamespace(l.config.Namespace)); err != nil {
2121
return nil, err

0 commit comments

Comments
 (0)