Skip to content

Commit

Permalink
refactor: simplify the naming of Operations to make it easier for the…
Browse files Browse the repository at this point in the history
… caller

Signed-off-by: Daniel Hu <tao.hu@merico.dev>
  • Loading branch information
daniel-hutao committed Aug 9, 2022
1 parent 33c62a8 commit 61bccd0
Show file tree
Hide file tree
Showing 67 changed files with 105 additions and 108 deletions.
2 changes: 1 addition & 1 deletion internal/pkg/plugin/argocd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.SetDefaultConfig(&defaultHelmConfig),
helm.Validate,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/argocd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
func Delete(options map[string]interface{}) (bool, error) {
// 1. config delete operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.SetDefaultConfig(&defaultHelmConfig),
helm.Validate,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/argocd/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const (
func Read(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config read operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.SetDefaultConfig(&defaultHelmConfig),
helm.Validate,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/argocd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func Update(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config update operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.SetDefaultConfig(&defaultHelmConfig),
helm.Validate,
},
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/argocdapp/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
kubectl.ProcessByContent(
"create", file.NewTemplate().FromContent(templateFileLoc),
),
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/argocdapp/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import (
func Delete(options map[string]interface{}) (bool, error) {
// 1. config install operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
kubectl.ProcessByContent(
"delete", file.NewTemplate().FromContent(templateFileLoc),
),
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/argocdapp/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
func Read(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
},
GetStateOperation: getDynamicState,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/artifactory/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
ExecuteOperations: helm.DefaultCreateOperations,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/artifactory/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
func Delete(options map[string]interface{}) (bool, error) {
// 1. config delete operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
ExecuteOperations: helm.DefaultDeleteOperations,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/artifactory/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func Read(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config read operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
GetStateOperation: helm.GetPluginAllState,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/artifactory/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func Update(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config update operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
ExecuteOperations: helm.DefaultUpdateOperations,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/devlake/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Operator{
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
kubectl.ProcessByContent(
"create", file.NewTemplate().FromRemote(devLakeInstallYAMLDownloadURL),
),
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/devlake/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func Delete(options map[string]interface{}) (bool, error) {
// 1. config delete operations
runner := &plugininstaller.Operator{
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
kubectl.ProcessByContent(
"delete", file.NewTemplate().FromRemote(devLakeInstallYAMLDownloadURL),
),
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/githubactions/golang/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
createDockerHubInfoForPush,
github.ProcessAction("create"),
},
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/githubactions/golang/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
// Delete remove GitHub Actions workflows.
func Delete(options map[string]interface{}) (bool, error) {
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
deleteDockerHubInfoForPush,
github.ProcessAction("delete"),
},
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/githubactions/golang/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func Read(options map[string]interface{}) (map[string]interface{}, error) {
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
github.BuildWorkFlowsWrapper(workflows),
},
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/githubactions/golang/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
// Update remove and set up GitHub Actions workflows.
func Update(options map[string]interface{}) (map[string]interface{}, error) {
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
deleteDockerHubInfoForPush,
createDockerHubInfoForPush,
github.ProcessAction("update"),
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/githubactions/nodejs/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
github.ProcessAction("create"),
},
GetStateOperation: github.GetStaticWorkFlowState,
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/githubactions/nodejs/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
// Delete remove GitHub Actions workflows.
func Delete(options map[string]interface{}) (bool, error) {
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
github.ProcessAction("delete"),
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/githubactions/nodejs/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func Read(options map[string]interface{}) (map[string]interface{}, error) {
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/githubactions/nodejs/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
// Update remove and set up GitHub Actions workflows.
func Update(options map[string]interface{}) (map[string]interface{}, error) {
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
github.ProcessAction("update"),
},
GetStateOperation: github.GetActionState,
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/githubactions/python/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
createDockerHubInfoForPush,
github.ProcessAction("create"),
},
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/githubactions/python/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (
// Delete remove GitHub Actions workflows.
func Delete(options map[string]interface{}) (bool, error) {
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
deleteDockerHubInfoForPush,
github.ProcessAction("delete"),
},
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/githubactions/python/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func Read(options map[string]interface{}) (map[string]interface{}, error) {
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/githubactions/python/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (
// Update remove and set up GitHub Actions workflows.
func Update(options map[string]interface{}) (map[string]interface{}, error) {
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
deleteDockerHubInfoForPush,
createDockerHubInfoForPush,
github.ProcessAction("update"),
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/plugin/gitlabcedocker/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ func Create(options map[string]interface{}) (map[string]interface{}, error) {

// 2. config install operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
dockerInstaller.Validate,
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
dockerInstaller.Install,
showHelpMsg,
},
TerminateOperations: []plugininstaller.BaseOperation{
TerminateOperations: plugininstaller.TerminateOperations{
dockerInstaller.ClearWhenInterruption,
},
GetStateOperation: dockerInstaller.GetStaticStateFromOptions,
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/gitlabcedocker/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ func Delete(options map[string]interface{}) (bool, error) {

// 2. config delete operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
dockerInstaller.Validate,
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
dockerInstaller.DeleteAll,
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/gitlabcedocker/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func Read(options map[string]interface{}) (map[string]interface{}, error) {

// 2. config read operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
dockerInstaller.Validate,
},
GetStateOperation: dockerInstaller.GetRunningState,
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/gitlabcedocker/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ func Update(options map[string]interface{}) (map[string]interface{}, error) {

// 2. config install operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
dockerInstaller.Validate,
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
dockerInstaller.DeleteAll,
dockerInstaller.Install,
showHelpMsg,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/harbor/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
ExecuteOperations: helm.DefaultCreateOperations,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/harbor/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
func Delete(options map[string]interface{}) (bool, error) {
// 1. config delete operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
ExecuteOperations: helm.DefaultDeleteOperations,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/harbor/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func Read(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config read operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
GetStateOperation: helm.GetPluginAllState,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/harbor/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func Update(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config update operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
ExecuteOperations: helm.DefaultUpdateOperations,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/hashicorpvault/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
ExecuteOperations: helm.DefaultCreateOperations,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/hashicorpvault/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
func Delete(options map[string]interface{}) (bool, error) {
// 1. config delete operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
ExecuteOperations: helm.DefaultDeleteOperations,
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/hashicorpvault/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func Read(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config read operations
runner := &plugininstaller.Operator{
PreExecuteOperations: []plugininstaller.MutableOperation{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
GetStateOperation: helm.GetPluginAllState,
Expand Down
Loading

0 comments on commit 61bccd0

Please sign in to comment.