MCPcopy Create free account
hub / github.com/devfile/api / Key

Method Key

pkg/apis/workspaces/v1alpha1/keyed.go:24–75  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22}
23
24func (union Component) Key() (string, error) {
25 key := ""
26 err := union.Visit(ComponentVisitor{
27 Container: func(container *ContainerComponent) error {
28 key = container.Name
29 return nil
30 },
31 Plugin: func(plugin *PluginComponent) error {
32 if plugin.Name != "" {
33 key = plugin.Name
34 return nil
35 }
36 return plugin.ImportReference.ImportReferenceUnion.Visit(ImportReferenceUnionVisitor{
37 Uri: func(uri string) error {
38 key = uri
39 return nil
40 },
41 Id: func(id string) error {
42 key = plugin.Id
43 if plugin.RegistryUrl != "" {
44 key = plugin.RegistryUrl + "/" + key
45 }
46 return nil
47 },
48 Kubernetes: func(cr *KubernetesCustomResourceImportReference) error {
49 key = cr.Name
50 if cr.Namespace != "" {
51 key = cr.Namespace + "/" + key
52 }
53 return nil
54 },
55 })
56 },
57 Kubernetes: func(k8s *KubernetesComponent) error {
58 key = k8s.Name
59 return nil
60 },
61 Openshift: func(os *OpenshiftComponent) error {
62 key = os.Name
63 return nil
64 },
65 Volume: func(vol *VolumeComponent) error {
66 key = vol.Name
67 return nil
68 },
69 Custom: func(custom *CustomComponent) error {
70 key = custom.Name
71 return nil
72 },
73 })
74 return key, err
75}
76
77func (union PluginComponentsOverride) Key() (string, error) {
78 key := ""

Callers

nothing calls this directly

Calls 2

VisitMethod · 0.95
VisitMethod · 0.45

Tested by

no test coverage detected