mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
rebase: IBM key protect integration module dependency update
This commit adds the Key protect client SDK for the Key Protect KMS integration to the Ceph CSI driver. Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
967076e4ba
commit
93e43d1a0f
75
vendor/github.com/IBM/keyprotect-go-client/key_rings.go
generated
vendored
Normal file
75
vendor/github.com/IBM/keyprotect-go-client/key_rings.go
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
package kp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
path = "key_rings"
|
||||
)
|
||||
|
||||
type KeyRing struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
CreationDate *time.Time `json:"creationDate,omitempty"`
|
||||
CreatedBy string `json:"createdBy,omitempty"`
|
||||
}
|
||||
|
||||
type KeyRings struct {
|
||||
Metadata KeysMetadata `json:"metadata"`
|
||||
KeyRings []KeyRing `json:"resources"`
|
||||
}
|
||||
|
||||
// CreateRing method creates a key ring in the instance with the provided name
|
||||
// For information please refer to the link below:
|
||||
// https://cloud.ibm.com/docs/key-protect?topic=key-protect-managing-key-rings#create-key-ring-api
|
||||
func (c *Client) CreateKeyRing(ctx context.Context, id string) error {
|
||||
|
||||
req, err := c.newRequest("POST", fmt.Sprintf(path+"/%s", id), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = c.do(ctx, req, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetRings method retrieves all the key rings associated with the instance
|
||||
// For information please refer to the link below:
|
||||
// https://cloud.ibm.com/docs/key-protect?topic=key-protect-managing-key-rings#list-key-ring-api
|
||||
func (c *Client) GetKeyRings(ctx context.Context) (*KeyRings, error) {
|
||||
rings := KeyRings{}
|
||||
req, err := c.newRequest("GET", path, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = c.do(ctx, req, &rings)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &rings, nil
|
||||
}
|
||||
|
||||
// DeleteRing method deletes the key ring with the provided name in the instance
|
||||
// For information please refer to the link below:
|
||||
// https://cloud.ibm.com/docs/key-protect?topic=key-protect-managing-key-rings#delete-key-ring-api
|
||||
func (c *Client) DeleteKeyRing(ctx context.Context, id string) error {
|
||||
req, err := c.newRequest("DELETE", fmt.Sprintf(path+"/%s", id), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = c.do(ctx, req, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user