-
Notifications
You must be signed in to change notification settings - Fork 63
/
meta.go
40 lines (33 loc) · 951 Bytes
/
meta.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
/**
* Copyright (c) F5, Inc.
*
* This source code is licensed under the Apache License, Version 2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
package grpc
import (
"github.com/gogo/protobuf/types"
sdk "github.com/nginx/agent/sdk/v2/proto"
)
var meta = &sdk.Metadata{}
func InitMeta(clientID, cloudAccountID string) {
meta.ClientId = clientID
meta.CloudAccountId = cloudAccountID
}
func NewMessageMeta(messageID string) *sdk.Metadata {
return &sdk.Metadata{
Timestamp: types.TimestampNow(),
ClientId: meta.ClientId,
CloudAccountId: meta.CloudAccountId,
MessageId: messageID,
}
}
// NewMeta returns a new Metadata struct defined in the sdk/proto folder
func NewMeta(clientID, messageID, cloudID string) *sdk.Metadata {
return &sdk.Metadata{
Timestamp: types.TimestampNow(),
ClientId: clientID,
MessageId: messageID,
CloudAccountId: cloudID,
}
}