-
Notifications
You must be signed in to change notification settings - Fork 156
/
parseedgenodeinfo.go
37 lines (30 loc) · 1023 Bytes
/
parseedgenodeinfo.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
// Copyright (c) 2022 Zededa, Inc.
// SPDX-License-Identifier: Apache-2.0
package zedagent
import (
zconfig "github.com/lf-edge/eve-api/go/config"
"github.com/lf-edge/eve/pkg/pillar/types"
uuid "github.com/satori/go.uuid"
)
// Get the node information
func parseEdgeNodeInfo(ctx *getconfigContext,
config *zconfig.EdgeDevConfig) {
log.Tracef("Started parsing edge node information")
deviceID, _ := uuid.FromString(config.GetId().Uuid)
projectID, _ := uuid.FromString(config.GetProjectId())
enInfo := types.EdgeNodeInfo{}
enInfo = types.EdgeNodeInfo{
DeviceName: config.GetDeviceName(),
DeviceID: deviceID,
ProjectName: config.GetProjectName(),
ProjectID: projectID,
EnterpriseName: config.GetEnterpriseName(),
EnterpriseID: config.GetEnterpriseId(),
}
publishEdgeNodeInfo(ctx, &enInfo)
}
func publishEdgeNodeInfo(ctx *getconfigContext, info *types.EdgeNodeInfo) {
pub := ctx.pubEdgeNodeInfo
pub.Publish("global", *info)
log.Traceln("Done publishing node information")
}