-
Notifications
You must be signed in to change notification settings - Fork 0
/
op_get.go
executable file
·51 lines (41 loc) · 1.03 KB
/
op_get.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
package kmip
import (
"context"
"github.com/baum/kmip-go/kmip14"
)
// GetRequestPayload ////////////////////////////////////////
//
type GetRequestPayload struct {
UniqueIdentifier string
}
// GetResponsePayload
type GetResponsePayload struct {
ObjectType kmip14.ObjectType
UniqueIdentifier string
Certificate *Certificate
SymmetricKey *SymmetricKey
PrivateKey *PrivateKey
PublicKey *PublicKey
SplitKey *SplitKey
Template *Template
SecretData *SecretData
OpaqueObject *OpaqueObject
}
type GetHandler struct {
Get func(ctx context.Context, payload *GetRequestPayload) (*GetResponsePayload, error)
}
func (h *GetHandler) HandleItem(ctx context.Context, req *Request) (*ResponseBatchItem, error) {
var payload GetRequestPayload
err := req.DecodePayload(&payload)
if err != nil {
return nil, err
}
respPayload, err := h.Get(ctx, &payload)
if err != nil {
return nil, err
}
// req.Key = respPayload.Key
return &ResponseBatchItem{
ResponsePayload: respPayload,
}, nil
}