-
Notifications
You must be signed in to change notification settings - Fork 0
/
factory.go
51 lines (48 loc) · 1.57 KB
/
factory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* *******************************************************************************
* * Copyright (c) 2023 Datasance Teknoloji A.S.
* *
* * This program and the accompanying materials are made available under the
* * terms of the Eclipse Public License v. 2.0 which is available at
* * http://www.eclipse.org/legal/epl-2.0
* *
* * SPDX-License-Identifier: EPL-2.0
* *******************************************************************************
*
*/
package get
import (
"github.com/datasance/potctl/internal/execute"
"github.com/datasance/potctl/pkg/util"
)
func NewExecutor(resourceType, namespace string, showDetached bool) (execute.Executor, error) {
switch resourceType {
case "namespaces":
return newNamespaceExecutor(), nil
case "all":
return newAllExecutor(namespace), nil
case "controllers":
return newControllerExecutor(namespace), nil
case "agents":
return newAgentExecutor(namespace, showDetached), nil
case "microservices":
return newMicroserviceExecutor(namespace), nil
case "application-templates":
return newApplicationTemplateExecutor(namespace), nil
case "applications":
return newApplicationExecutor(namespace), nil
case "catalog":
return newCatalogExecutor(namespace), nil
case "registries":
return newRegistryExecutor(namespace), nil
case "volumes":
return newVolumeExecutor(namespace), nil
case "routes":
return newRouteExecutor(namespace), nil
case "edge-resources":
return newEdgeResourceExecutor(namespace), nil
default:
msg := "Unknown resource: '" + resourceType + "'"
return nil, util.NewInputError(msg)
}
}