Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Make Options More Readable #1186

Merged
merged 5 commits into from
Oct 18, 2022
Merged
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
10 changes: 6 additions & 4 deletions cmd/plugin/argocd/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"github.com/devstream-io/devstream/internal/pkg/configmanager"
"github.com/devstream-io/devstream/internal/pkg/plugin/argocd"
"github.com/devstream-io/devstream/internal/pkg/statemanager"
"github.com/devstream-io/devstream/pkg/util/log"
)

Expand All @@ -12,22 +14,22 @@ const NAME = "argocd"
type Plugin string

// Create implements the create of ArgoCD.
func (p Plugin) Create(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Create(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return argocd.Create(options)
}

// Update implements the update of ArgoCD.
func (p Plugin) Update(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Update(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return argocd.Update(options)
}

// Delete implements the delete of ArgoCD.
func (p Plugin) Delete(options map[string]interface{}) (bool, error) {
func (p Plugin) Delete(options configmanager.RawOptions) (bool, error) {
return argocd.Delete(options)
}

// Read implements the read of ArgoCD.
func (p Plugin) Read(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Read(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return argocd.Read(options)
}

Expand Down
10 changes: 6 additions & 4 deletions cmd/plugin/argocdapp/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"github.com/devstream-io/devstream/internal/pkg/configmanager"
"github.com/devstream-io/devstream/internal/pkg/plugin/argocdapp"
"github.com/devstream-io/devstream/internal/pkg/statemanager"
"github.com/devstream-io/devstream/pkg/util/log"
)

Expand All @@ -12,22 +14,22 @@ const NAME = "argocdapp"
type Plugin string

// Create implements the installation of an ArgoCD app.
func (p Plugin) Create(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Create(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return argocdapp.Create(options)
}

// Update implements the installation of an ArgoCD app.
func (p Plugin) Update(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Update(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return argocdapp.Update(options)
}

// Read implements the healthy check of ArgoCD app.
func (p Plugin) Read(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Read(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return argocdapp.Read(options)
}

// Delete Deletes the installation of an ArgoCD app.
func (p Plugin) Delete(options map[string]interface{}) (bool, error) {
func (p Plugin) Delete(options configmanager.RawOptions) (bool, error) {
return argocdapp.Delete(options)
}

Expand Down
10 changes: 6 additions & 4 deletions cmd/plugin/artifactory/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"github.com/devstream-io/devstream/internal/pkg/configmanager"
"github.com/devstream-io/devstream/internal/pkg/plugin/artifactory"
"github.com/devstream-io/devstream/internal/pkg/statemanager"
"github.com/devstream-io/devstream/pkg/util/log"
)

Expand All @@ -12,22 +14,22 @@ const NAME = "artifactory"
type Plugin string

// Create implements the create of artifactory.
func (p Plugin) Create(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Create(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return artifactory.Create(options)
}

// Update implements the update of artifactory.
func (p Plugin) Update(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Update(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return artifactory.Update(options)
}

// Delete implements the delete of artifactory.
func (p Plugin) Delete(options map[string]interface{}) (bool, error) {
func (p Plugin) Delete(options configmanager.RawOptions) (bool, error) {
return artifactory.Delete(options)
}

// Read implements the read of artifactory.
func (p Plugin) Read(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Read(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return artifactory.Read(options)
}

Expand Down
10 changes: 6 additions & 4 deletions cmd/plugin/ci-generic/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"github.com/devstream-io/devstream/internal/pkg/configmanager"
"github.com/devstream-io/devstream/internal/pkg/plugin/cigeneric"
"github.com/devstream-io/devstream/internal/pkg/statemanager"
"github.com/devstream-io/devstream/pkg/util/log"
)

Expand All @@ -12,22 +14,22 @@ const NAME = "ci-generic"
type Plugin string

// Create implements the create of ci-generic.
func (p Plugin) Create(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Create(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return cigeneric.Create(options)
}

// Update implements the update of ci-generic.
func (p Plugin) Update(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Update(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return cigeneric.Update(options)
}

// Delete implements the delete of ci-generic.
func (p Plugin) Delete(options map[string]interface{}) (bool, error) {
func (p Plugin) Delete(options configmanager.RawOptions) (bool, error) {
return cigeneric.Delete(options)
}

// Read implements the read of ci-generic.
func (p Plugin) Read(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Read(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return cigeneric.Read(options)
}

Expand Down
10 changes: 6 additions & 4 deletions cmd/plugin/devlake-config/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"github.com/devstream-io/devstream/internal/pkg/configmanager"
"github.com/devstream-io/devstream/internal/pkg/plugin/devlakeconfig"
"github.com/devstream-io/devstream/internal/pkg/statemanager"
"github.com/devstream-io/devstream/pkg/util/log"
)

Expand All @@ -12,22 +14,22 @@ const NAME = "devlake-config"
type Plugin string

// Create implements the create of devlake-config.
func (p Plugin) Create(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Create(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return devlakeconfig.Create(options)
}

// Update implements the update of devlake-config.
func (p Plugin) Update(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Update(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return devlakeconfig.Update(options)
}

// Delete implements the delete of devlake-config.
func (p Plugin) Delete(options map[string]interface{}) (bool, error) {
func (p Plugin) Delete(options configmanager.RawOptions) (bool, error) {
return devlakeconfig.Delete(options)
}

// Read implements the read of devlake-config.
func (p Plugin) Read(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Read(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return devlakeconfig.Read(options)
}

Expand Down
10 changes: 6 additions & 4 deletions cmd/plugin/devlake/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"github.com/devstream-io/devstream/internal/pkg/configmanager"
"github.com/devstream-io/devstream/internal/pkg/plugin/devlake"
"github.com/devstream-io/devstream/internal/pkg/statemanager"
"github.com/devstream-io/devstream/pkg/util/log"
)

Expand All @@ -12,22 +14,22 @@ const NAME = "devlake"
type Plugin string

// Create implements the create of devlake.
func (p Plugin) Create(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Create(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return devlake.Create(options)
}

// Update implements the update of devlake.
func (p Plugin) Update(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Update(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return devlake.Update(options)
}

// Delete implements the delete of devlake.
func (p Plugin) Delete(options map[string]interface{}) (bool, error) {
func (p Plugin) Delete(options configmanager.RawOptions) (bool, error) {
return devlake.Delete(options)
}

// Read implements the read of devlake.
func (p Plugin) Read(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Read(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return devlake.Read(options)
}

Expand Down
10 changes: 6 additions & 4 deletions cmd/plugin/githubactions-golang/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"github.com/devstream-io/devstream/internal/pkg/configmanager"
"github.com/devstream-io/devstream/internal/pkg/plugin/githubactions/golang"
"github.com/devstream-io/devstream/internal/pkg/statemanager"
"github.com/devstream-io/devstream/pkg/util/log"
)

Expand All @@ -12,22 +14,22 @@ const NAME = "githubactions-golang"
type Plugin string

// Create implements the installation of some GitHub Actions workflows.
func (p Plugin) Create(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Create(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return golang.Create(options)
}

// Update implements the installation of some GitHub Actions workflows.
func (p Plugin) Update(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Update(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return golang.Update(options)
}

// Read implements the healthy check of GitHub Actions workflows.
func (p Plugin) Read(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Read(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return golang.Read(options)
}

// Delete implements the installation of some GitHub Actions workflows.
func (p Plugin) Delete(options map[string]interface{}) (bool, error) {
func (p Plugin) Delete(options configmanager.RawOptions) (bool, error) {
return golang.Delete(options)
}

Expand Down
10 changes: 6 additions & 4 deletions cmd/plugin/githubactions-nodejs/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"github.com/devstream-io/devstream/internal/pkg/configmanager"
"github.com/devstream-io/devstream/internal/pkg/plugin/githubactions/nodejs"
"github.com/devstream-io/devstream/internal/pkg/statemanager"
"github.com/devstream-io/devstream/pkg/util/log"
)

Expand All @@ -12,22 +14,22 @@ const NAME = "githubactions-nodejs"
type Plugin string

// Create implements the installation of some GitHub Actions workflows.
func (p Plugin) Create(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Create(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return nodejs.Create(options)
}

// Update implements the installation of some GitHub Actions workflows.
func (p Plugin) Update(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Update(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return nodejs.Update(options)
}

// Read implements the healthy check of GitHub Actions workflows.
func (p Plugin) Read(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Read(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return nodejs.Read(options)
}

// Delete implements the installation of some GitHub Actions workflows.
func (p Plugin) Delete(options map[string]interface{}) (bool, error) {
func (p Plugin) Delete(options configmanager.RawOptions) (bool, error) {
return nodejs.Delete(options)
}

Expand Down
10 changes: 6 additions & 4 deletions cmd/plugin/githubactions-python/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"github.com/devstream-io/devstream/internal/pkg/configmanager"
"github.com/devstream-io/devstream/internal/pkg/plugin/githubactions/python"
"github.com/devstream-io/devstream/internal/pkg/statemanager"
"github.com/devstream-io/devstream/pkg/util/log"
)

Expand All @@ -12,22 +14,22 @@ const NAME = "githubactions-python"
type Plugin string

// Create implements the installation of some GitHub Actions workflows.
func (p Plugin) Create(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Create(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return python.Create(options)
}

// Update implements the installation of some GitHub Actions workflows.
func (p Plugin) Update(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Update(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return python.Update(options)
}

// Read implements the healthy check of GitHub Actions workflows.
func (p Plugin) Read(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Read(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return python.Read(options)
}

// Delete implements the installation of some GitHub Actions workflows.
func (p Plugin) Delete(options map[string]interface{}) (bool, error) {
func (p Plugin) Delete(options configmanager.RawOptions) (bool, error) {
return python.Delete(options)
}

Expand Down
10 changes: 6 additions & 4 deletions cmd/plugin/gitlab-ce-docker/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package main

import (
"github.com/devstream-io/devstream/internal/pkg/configmanager"
"github.com/devstream-io/devstream/internal/pkg/plugin/gitlabcedocker"
"github.com/devstream-io/devstream/internal/pkg/statemanager"
"github.com/devstream-io/devstream/pkg/util/log"
)

Expand All @@ -12,22 +14,22 @@ const NAME = "gitlab-ce-docker"
type Plugin string

// Create implements the create of gitlab-ce-docker.
func (p Plugin) Create(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Create(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return gitlabcedocker.Create(options)
}

// Update implements the update of gitlab-ce-docker.
func (p Plugin) Update(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Update(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return gitlabcedocker.Update(options)
}

// Delete implements the delete of gitlab-ce-docker.
func (p Plugin) Delete(options map[string]interface{}) (bool, error) {
func (p Plugin) Delete(options configmanager.RawOptions) (bool, error) {
return gitlabcedocker.Delete(options)
}

// Read implements the read of gitlab-ce-docker.
func (p Plugin) Read(options map[string]interface{}) (map[string]interface{}, error) {
func (p Plugin) Read(options configmanager.RawOptions) (statemanager.ResourceStatus, error) {
return gitlabcedocker.Read(options)
}

Expand Down
Loading