aboutsummaryrefslogtreecommitdiffstats
path: root/src/k8splugin/mock_files/mock_plugins/mockplugin.go
diff options
context:
space:
mode:
authorBin Yang <bin.yang@windriver.com>2019-06-19 22:46:37 +0000
committerGerrit Code Review <gerrit@onap.org>2019-06-19 22:46:37 +0000
commit36bd529eefdf43e552f420ab0a1d52fd560b837f (patch)
tree9cc2974f1c6dc91c0e54300a96963aa11bce1780 /src/k8splugin/mock_files/mock_plugins/mockplugin.go
parentc1963d4331fce447d93131d731e1f261c175de87 (diff)
parentd780f1b30c98a27d269e3e05423e9e54e0e022f6 (diff)
Merge "Plugin code refactoring"
Diffstat (limited to 'src/k8splugin/mock_files/mock_plugins/mockplugin.go')
-rw-r--r--src/k8splugin/mock_files/mock_plugins/mockplugin.go31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/k8splugin/mock_files/mock_plugins/mockplugin.go b/src/k8splugin/mock_files/mock_plugins/mockplugin.go
index bdc2130c..0c3d246d 100644
--- a/src/k8splugin/mock_files/mock_plugins/mockplugin.go
+++ b/src/k8splugin/mock_files/mock_plugins/mockplugin.go
@@ -14,30 +14,43 @@ limitations under the License.
package main
import (
- "k8s.io/client-go/kubernetes"
+ "k8splugin/internal/helm"
+ "k8splugin/internal/plugin"
- utils "k8splugin/internal"
+ "k8s.io/apimachinery/pkg/runtime/schema"
)
-func main() {}
+// ExportedVariable is what we will look for when calling the plugin
+var ExportedVariable mockPlugin
+
+type mockPlugin struct {
+}
// Create object in a specific Kubernetes resource
-func Create(data *utils.ResourceData, client kubernetes.Interface) (string, error) {
+func (p mockPlugin) Create(yamlFilePath string, namespace string, client plugin.KubernetesConnector) (string, error) {
return "resource-name", nil
}
// List of existing resources
-func List(namespace string, client kubernetes.Interface) ([]string, error) {
- returnVal := []string{"resource-name-1", "resource-name-2"}
+func (p mockPlugin) List(gvk schema.GroupVersionKind, namespace string,
+ client plugin.KubernetesConnector) ([]helm.KubernetesResource, error) {
+ returnVal := []helm.KubernetesResource{
+ {
+ Name: "resource-name-1",
+ },
+ {
+ Name: "resource-name-2",
+ },
+ }
return returnVal, nil
}
// Delete existing resources
-func Delete(name string, namespace string, client kubernetes.Interface) error {
+func (p mockPlugin) Delete(resource helm.KubernetesResource, namespace string, client plugin.KubernetesConnector) error {
return nil
}
// Get existing resource host
-func Get(name string, namespace string, client kubernetes.Interface) (string, error) {
- return name, nil
+func (p mockPlugin) Get(resource helm.KubernetesResource, namespace string, client plugin.KubernetesConnector) (string, error) {
+ return resource.Name, nil
}