-
Notifications
You must be signed in to change notification settings - Fork 0
/
node-endpoint.go
52 lines (41 loc) · 996 Bytes
/
node-endpoint.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
package node
import (
"context"
"mmesh.dev/m-api-go/grpc/resources/topology"
"mmesh.dev/m-cli/pkg/grpc"
"mmesh.dev/m-cli/pkg/output"
"mmesh.dev/m-cli/pkg/status"
"mmesh.dev/m-lib/pkg/mm"
)
func (api *API) ShowEndpoint() {
n := GetNodeByTenant(false, mm.Bool(true))
eID := GetEndpoint(n).EndpointID
for endpointID, e := range n.Endpoints {
if endpointID == eID {
// output.Show(e)
Output().ShowEndpoint(e)
}
}
}
func (api *API) DeleteEndpoint() {
n := GetNodeByTenant(false, mm.Bool(true))
eID := GetEndpoint(n).EndpointID
s := output.Spinner()
nxc, grpcConn := grpc.GetTopologyAPIClient()
defer grpcConn.Close()
er := &topology.EndpointRequest{
NodeReq: &topology.NodeReq{
AccountID: n.AccountID,
TenantID: n.TenantID,
NodeID: n.NodeID,
},
EndpointID: eID,
}
sr, err := nxc.DeleteNetworkEndpoint(context.TODO(), er)
if err != nil {
s.Stop()
status.Error(err, "Unable to delete node network endpoint")
}
s.Stop()
output.Show(sr)
}