-
Notifications
You must be signed in to change notification settings - Fork 0
/
registry.go
57 lines (48 loc) · 1.32 KB
/
registry.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
52
53
54
55
56
57
/*
* *******************************************************************************
* * 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 deleteregistry
import (
"strconv"
"github.com/datasance/potctl/internal/execute"
clientutil "github.com/datasance/potctl/internal/util/client"
"github.com/datasance/potctl/pkg/util"
)
type Executor struct {
namespace string
id int
}
func NewExecutor(namespace, name string) (execute.Executor, error) {
id, err := strconv.Atoi(name)
if err != nil {
return nil, err
}
exe := &Executor{
namespace: namespace,
id: id,
}
return exe, nil
}
// GetName returns application name
func (exe *Executor) GetName() string {
return strconv.Itoa(exe.id)
}
// Execute deletes application by deleting its associated flow
func (exe *Executor) Execute() error {
util.SpinStart("Deleting Registry")
// Init remote resources
clt, err := clientutil.NewControllerClient(exe.namespace)
if err != nil {
return err
}
return clt.DeleteRegistry(exe.id)
}