mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-27 16:50:23 +00:00
0f2daca5c2
The new release has some important fixes available with it Ref: https://github.com/ThalesGroup/kmip-go/releases/tag/v0.0.8 Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
51 lines
1.0 KiB
Go
51 lines
1.0 KiB
Go
package kmip
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/gemalto/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
|
|
}
|