providers

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCreateKeyFailed        = errors.New("create key failed")
	ErrCreateKeyVersionFailed = errors.New("key version creation failed")
	ErrRotateKeyFailed        = errors.New("rotate key failed")
	ErrKeyVersions            = errors.New("key has no previous keyVersions")
	ErrEnableKeyFailed        = errors.New("enabling key failed")
	ErrDisableKeyFailed       = errors.New("disabling key failed")
	ErrDeleteKeyFailed        = errors.New("deleting key failed")
)

Errs defines the errors that can be returned by the provider

View Source
var (
	ErrDeleteKeyVersionFailed = errors.New("delete key version failed")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	CreateKeyVersion(ctx context.Context, options KeyInput) (*string, error)
	DeleteKeyVersion(ctx context.Context, keyID string, options DeleteOptions) error
	EnableKeyVersion(ctx context.Context, keyID string) error
	DisableKeyVersion(ctx context.Context, keyID string) error
}

Client is the interface for native KMS. Any KMS providers client we intend to use must implement this interface. This requires wrapping an SDK client to conform to this interface. For instance, refer to aws.client.

type DeleteOptions

type DeleteOptions struct {
	Window *int32 // The grace period after deletion where the key material still exists in the provider
}

DeleteOptions holds the aws_options for delete actions.

type InvalidStateError

type InvalidStateError struct {
	Message string
}

InvalidStateError it is error that points out that action in Client cannot be executed due to the state of the key. For example, trying to delete a key that is already deleted.

func (*InvalidStateError) Error

func (e *InvalidStateError) Error() string

type Key

type Key struct {
	ID          *string
	KeyType     KeyAlgorithm
	Provider    string
	Region      string
	Version     int
	KeyVersions []KeyVersion
}

Key represents a key.

type KeyAlgorithm

type KeyAlgorithm string

KeyAlgorithm represents the algorithm of the key.

const (
	AES256  KeyAlgorithm = "AES256"
	RSA3072 KeyAlgorithm = "RSA3072"
	RSA4096 KeyAlgorithm = "RSA4096"
)

type KeyInput

type KeyInput struct {
	KeyType KeyAlgorithm
	ID      *string
}

KeyInput holds the aws_options for creating a key.

type KeyState

type KeyState string

KeyState represents the state of the key.

const (
	ENABLED  KeyState = "ENABLED"
	DISABLED KeyState = "DISABLED"
	DELETED  KeyState = "DELETED"
	ERROR    KeyState = "ERROR"
)

type KeyVersion

type KeyVersion struct {
	ExternalID *string
	CreatedAt  *time.Time
	UpdatedAt  *time.Time
	Version    int
	State      KeyState
}

KeyVersion represents the version of a key.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider is the implementation of the KMS provider

func NewProvider

func NewProvider(client Client) *Provider

NewProvider creates a new instance of Provider

func (*Provider) CreateKey

func (p *Provider) CreateKey(
	ctx context.Context,
	input KeyInput,
) (*Key, error)

CreateKey creates a new key.

func (*Provider) DeleteKey

func (p *Provider) DeleteKey(
	ctx context.Context,
	key *Key,
	deleteKeyOptions DeleteOptions,
) error

DeleteKey deletes all versions of a key. Takes into consideration manually deleted versions.

func (*Provider) DisableKey

func (p *Provider) DisableKey(ctx context.Context, key *Key) error

DisableKey disables all versions of a key

func (*Provider) EnableKey

func (p *Provider) EnableKey(ctx context.Context, key *Key) error

EnableKey enables current key version

func (*Provider) RotateKey

func (p *Provider) RotateKey(ctx context.Context, key *Key) error

RotateKey rotates the current key version

Directories

Path Synopsis
clients
aws

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL