Skip to content

Commit

Permalink
api: add crypto.ManagerKmip.QueryCryptoKeyStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
dougm committed Oct 29, 2024
1 parent def262d commit 6ecb208
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions crypto/manager_kmip.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ import (
"github.com/vmware/govmomi/vim25/types"
)

const (
CheckKeyAvailable = int32(0x01)
CheckKeyUsedByVms = int32(0x02)
CheckKeyUsedByHosts = int32(0x04)
CheckKeyUsedByOther = int32(0x08)
)

type ManagerKmip struct {
object.Common
}
Expand Down Expand Up @@ -313,6 +320,24 @@ func (m ManagerKmip) RemoveKmipServer(
return nil
}

func (m ManagerKmip) QueryCryptoKeyStatus(
ctx context.Context,
ids []types.CryptoKeyId,
check int32) ([]types.CryptoManagerKmipCryptoKeyStatus, error) {

req := types.QueryCryptoKeyStatus{
This: m.Reference(),
KeyIds: ids,
CheckKeyBitMap: check,
}

res, err := methods.QueryCryptoKeyStatus(ctx, m.Client(), &req)
if err != nil {
return nil, err
}
return res.Returnval, nil
}

func (m ManagerKmip) ListKeys(
ctx context.Context,
limit *int32) ([]types.CryptoKeyId, error) {
Expand Down Expand Up @@ -413,6 +438,21 @@ func (m ManagerKmip) GenerateKey(
return res.Returnval.KeyId.KeyId, nil
}

func (m ManagerKmip) RemoveKeys(
ctx context.Context,
ids []types.CryptoKeyId,
force bool) error {

req := types.RemoveKeys{
This: m.Reference(),
Keys: ids,
Force: force,
}

_, err := methods.RemoveKeys(ctx, m.Client(), &req)
return err
}

type generateKeyError struct {
types.LocalizedMethodFault
reason string
Expand Down

0 comments on commit 6ecb208

Please sign in to comment.