certificate

package
v0.0.0-...-63dd1cf Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package certificate provides CA certificate management operations. Supports listing system and custom CA certificates, and managing custom certificates in /usr/local/share/ca-certificates/. Delegates file writes to the file provider for SHA tracking, idempotency, and template rendering.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateResult

type CreateResult struct {
	Name    string `json:"name"`
	Changed bool   `json:"changed"`
	Error   string `json:"error,omitempty"`
}

CreateResult represents the outcome of a CA certificate creation.

type Darwin

type Darwin struct{}

Darwin implements the Provider interface for Darwin (macOS). All methods return ErrUnsupported as certificate management is not available on macOS.

func NewDarwinProvider

func NewDarwinProvider() *Darwin

NewDarwinProvider factory to create a new Darwin instance.

func (*Darwin) Create

func (d *Darwin) Create(
	_ context.Context,
	_ Entry,
) (*CreateResult, error)

Create returns ErrUnsupported on Darwin.

func (*Darwin) Delete

func (d *Darwin) Delete(
	_ context.Context,
	_ string,
) (*DeleteResult, error)

Delete returns ErrUnsupported on Darwin.

func (*Darwin) List

func (d *Darwin) List(
	_ context.Context,
) ([]Entry, error)

List returns ErrUnsupported on Darwin.

func (*Darwin) Update

func (d *Darwin) Update(
	_ context.Context,
	_ Entry,
) (*UpdateResult, error)

Update returns ErrUnsupported on Darwin.

type Debian

type Debian struct {
	provider.FactsAware
	// contains filtered or unexported fields
}

Debian implements the Provider interface for Debian-family systems. It delegates file writes to a FileDeployer for SHA tracking and idempotency. Managed files are identified by their presence in the file-state KV with an osapi- filename prefix.

func NewDebianProvider

func NewDebianProvider(
	logger *slog.Logger,
	fs avfs.VFS,
	fileDeployer file.Deployer,
	stateKV jetstream.KeyValue,
	execManager exec.Manager,
	hostname string,
) *Debian

NewDebianProvider factory to create a new Debian instance.

func (*Debian) Create

func (d *Debian) Create(
	ctx context.Context,
	entry Entry,
) (*CreateResult, error)

Create deploys a new CA certificate via the file provider.

func (*Debian) Delete

func (d *Debian) Delete(
	ctx context.Context,
	name string,
) (*DeleteResult, error)

Delete undeploys a CA certificate via the file provider.

func (*Debian) List

func (d *Debian) List(
	ctx context.Context,
) ([]Entry, error)

List returns all system and osapi-managed CA certificates.

func (*Debian) Update

func (d *Debian) Update(
	ctx context.Context,
	entry Entry,
) (*UpdateResult, error)

Update redeploys an existing CA certificate via the file provider.

type DeleteResult

type DeleteResult struct {
	Name    string `json:"name"`
	Changed bool   `json:"changed"`
	Error   string `json:"error,omitempty"`
}

DeleteResult represents the outcome of a CA certificate deletion.

type Entry

type Entry struct {
	Name   string `json:"name"`
	Source string `json:"source,omitempty"`
	Object string `json:"object,omitempty"`
}

Entry represents a CA certificate entry.

type Linux

type Linux struct{}

Linux implements the Provider interface for generic Linux. All methods return ErrUnsupported as this is a generic Linux stub.

func NewLinuxProvider

func NewLinuxProvider() *Linux

NewLinuxProvider factory to create a new Linux instance.

func (*Linux) Create

func (l *Linux) Create(
	_ context.Context,
	_ Entry,
) (*CreateResult, error)

Create returns ErrUnsupported on generic Linux.

func (*Linux) Delete

func (l *Linux) Delete(
	_ context.Context,
	_ string,
) (*DeleteResult, error)

Delete returns ErrUnsupported on generic Linux.

func (*Linux) List

func (l *Linux) List(
	_ context.Context,
) ([]Entry, error)

List returns ErrUnsupported on generic Linux.

func (*Linux) Update

func (l *Linux) Update(
	_ context.Context,
	_ Entry,
) (*UpdateResult, error)

Update returns ErrUnsupported on generic Linux.

type Provider

type Provider interface {
	// List returns all system and osapi-managed CA certificates.
	List(ctx context.Context) ([]Entry, error)
	// Create deploys a new CA certificate via the file provider.
	Create(ctx context.Context, entry Entry) (*CreateResult, error)
	// Update redeploys an existing CA certificate via the file provider.
	Update(ctx context.Context, entry Entry) (*UpdateResult, error)
	// Delete undeploys a CA certificate via the file provider.
	Delete(ctx context.Context, name string) (*DeleteResult, error)
}

Provider implements the methods to manage CA certificates.

type UpdateResult

type UpdateResult struct {
	Name    string `json:"name"`
	Changed bool   `json:"changed"`
	Error   string `json:"error,omitempty"`
}

UpdateResult represents the outcome of a CA certificate update.

Directories

Path Synopsis
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.

Jump to

Keyboard shortcuts

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