Documentation
¶
Index ¶
- Variables
- func Register(adapter Adapter) error
- type ACMEHandler
- func (h *ACMEHandler) GenerateCertificate(ctx context.Context, req CertificateRequest, config AdapterConfig) (*CertificateResult, error)
- func (h *ACMEHandler) ListCertificates(ctx context.Context, config AdapterConfig) ([]CertificateInfo, error)
- func (h *ACMEHandler) RevokeCertificate(ctx context.Context, serial string, config AdapterConfig) error
- func (h *ACMEHandler) VerifyCertificate(ctx context.Context, cert []byte, config AdapterConfig) error
- type Adapter
- type AdapterConfig
- type AdapterType
- type Capabilities
- type CertificateAdapter
- func (a *CertificateAdapter) Capabilities() Capabilities
- func (a *CertificateAdapter) Execute(ctx context.Context, operation Operation, config AdapterConfig) (*Result, error)
- func (a *CertificateAdapter) Name() string
- func (a *CertificateAdapter) Type() AdapterType
- func (a *CertificateAdapter) Validate(config AdapterConfig) error
- type CertificateHandler
- type CertificateInfo
- type CertificateRequest
- type CertificateResult
- type HTTPAPIAdapter
- func (a *HTTPAPIAdapter) Capabilities() Capabilities
- func (a *HTTPAPIAdapter) Execute(ctx context.Context, operation Operation, config AdapterConfig) (*Result, error)
- func (a *HTTPAPIAdapter) Name() string
- func (a *HTTPAPIAdapter) Type() AdapterType
- func (a *HTTPAPIAdapter) Validate(config AdapterConfig) error
- type MockNoSQLConnection
- type MongoHandler
- type NoSQLAdapter
- func (a *NoSQLAdapter) Capabilities() Capabilities
- func (a *NoSQLAdapter) Execute(ctx context.Context, operation Operation, config AdapterConfig) (*Result, error)
- func (a *NoSQLAdapter) Name() string
- func (a *NoSQLAdapter) Type() AdapterType
- func (a *NoSQLAdapter) Validate(config AdapterConfig) error
- type NoSQLConnection
- type NoSQLHandler
- type Operation
- type RedisHandler
- type Registry
- type Result
- type SQLAdapter
- type SelfSignedHandler
- func (h *SelfSignedHandler) GenerateCertificate(ctx context.Context, req CertificateRequest, config AdapterConfig) (*CertificateResult, error)
- func (h *SelfSignedHandler) ListCertificates(ctx context.Context, config AdapterConfig) ([]CertificateInfo, error)
- func (h *SelfSignedHandler) RevokeCertificate(ctx context.Context, serial string, config AdapterConfig) error
- func (h *SelfSignedHandler) VerifyCertificate(ctx context.Context, certPEM []byte, config AdapterConfig) error
Constants ¶
This section is empty.
Variables ¶
var DefaultRegistry = NewRegistry()
DefaultRegistry is the global protocol adapter registry
Functions ¶
Types ¶
type ACMEHandler ¶
type ACMEHandler struct{}
ACMEHandler handles ACME protocol certificates (placeholder)
func (*ACMEHandler) GenerateCertificate ¶
func (h *ACMEHandler) GenerateCertificate(ctx context.Context, req CertificateRequest, config AdapterConfig) (*CertificateResult, error)
func (*ACMEHandler) ListCertificates ¶
func (h *ACMEHandler) ListCertificates(ctx context.Context, config AdapterConfig) ([]CertificateInfo, error)
func (*ACMEHandler) RevokeCertificate ¶
func (h *ACMEHandler) RevokeCertificate(ctx context.Context, serial string, config AdapterConfig) error
func (*ACMEHandler) VerifyCertificate ¶
func (h *ACMEHandler) VerifyCertificate(ctx context.Context, cert []byte, config AdapterConfig) error
type Adapter ¶
type Adapter interface {
// Name returns the adapter name
Name() string
// Type returns the adapter type (sql, http-api, nosql, certificate)
Type() AdapterType
// Execute performs a protocol operation
Execute(ctx context.Context, operation Operation, config AdapterConfig) (*Result, error)
// Validate checks if the adapter configuration is valid
Validate(config AdapterConfig) error
// Capabilities returns what operations this adapter supports
Capabilities() Capabilities
}
Adapter defines the interface for protocol adapters
func Get ¶
func Get(adapterType AdapterType) (Adapter, error)
Get retrieves an adapter from the default registry
func GetByProtocol ¶
GetByProtocol retrieves an adapter by protocol string from the default registry
type AdapterConfig ¶
type AdapterConfig struct {
// Connection details (host, port, etc.)
Connection map[string]string
// Authentication credentials
Auth map[string]string
// Service-specific configuration from dsops-data
ServiceConfig map[string]interface{}
// Timeout and retry settings
Timeout int // seconds
Retries int
}
AdapterConfig contains configuration for protocol adapters
type AdapterType ¶
type AdapterType string
AdapterType represents the type of protocol adapter
const ( // AdapterTypeSQL handles SQL database operations (PostgreSQL, MySQL, etc.) AdapterTypeSQL AdapterType = "sql" // AdapterTypeHTTPAPI handles REST/HTTP API operations (Stripe, GitHub, etc.) AdapterTypeHTTPAPI AdapterType = "http-api" // AdapterTypeNoSQL handles NoSQL database operations (MongoDB, Redis, etc.) AdapterTypeNoSQL AdapterType = "nosql" // AdapterTypeCertificate handles certificate operations (ACME, Venafi, etc.) AdapterTypeCertificate AdapterType = "certificate" )
type Capabilities ¶
type Capabilities struct {
// SupportedActions lists operations this adapter can perform
SupportedActions []string
// RequiredConfig lists required configuration fields
RequiredConfig []string
// OptionalConfig lists optional configuration fields
OptionalConfig []string
// Features describes special features
Features map[string]bool
}
Capabilities describes what an adapter can do
type CertificateAdapter ¶
type CertificateAdapter struct {
// contains filtered or unexported fields
}
CertificateAdapter implements the Adapter interface for certificate operations
func NewCertificateAdapter ¶
func NewCertificateAdapter() *CertificateAdapter
NewCertificateAdapter creates a new certificate protocol adapter
func (*CertificateAdapter) Capabilities ¶
func (a *CertificateAdapter) Capabilities() Capabilities
Capabilities returns what this adapter can do
func (*CertificateAdapter) Execute ¶
func (a *CertificateAdapter) Execute(ctx context.Context, operation Operation, config AdapterConfig) (*Result, error)
Execute performs a certificate operation
func (*CertificateAdapter) Name ¶
func (a *CertificateAdapter) Name() string
Name returns the adapter name
func (*CertificateAdapter) Type ¶
func (a *CertificateAdapter) Type() AdapterType
Type returns the adapter type
func (*CertificateAdapter) Validate ¶
func (a *CertificateAdapter) Validate(config AdapterConfig) error
Validate checks if the configuration is valid
type CertificateHandler ¶
type CertificateHandler interface {
GenerateCertificate(ctx context.Context, req CertificateRequest, config AdapterConfig) (*CertificateResult, error)
VerifyCertificate(ctx context.Context, cert []byte, config AdapterConfig) error
RevokeCertificate(ctx context.Context, serial string, config AdapterConfig) error
ListCertificates(ctx context.Context, config AdapterConfig) ([]CertificateInfo, error)
}
CertificateHandler defines the interface for specific certificate protocol handlers
type CertificateInfo ¶
type CertificateInfo struct {
SerialNumber string
Subject string
Issuer string
NotBefore time.Time
NotAfter time.Time
DNSNames []string
Status string
}
CertificateInfo contains certificate metadata
type CertificateRequest ¶
type CertificateRequest struct {
CommonName string
Organization []string
OrganizationalUnit []string
Country []string
Province []string
Locality []string
DNSNames []string
EmailAddresses []string
IPAddresses []string
ValidityDays int
KeySize int
}
CertificateRequest contains parameters for certificate generation
type CertificateResult ¶
type CertificateResult struct {
Certificate []byte
PrivateKey []byte
CertificateChain []byte
SerialNumber string
NotBefore time.Time
NotAfter time.Time
}
CertificateResult contains the generated certificate and key
type HTTPAPIAdapter ¶
type HTTPAPIAdapter struct {
// contains filtered or unexported fields
}
HTTPAPIAdapter implements the Adapter interface for HTTP/REST API services
func NewHTTPAPIAdapter ¶
func NewHTTPAPIAdapter() *HTTPAPIAdapter
NewHTTPAPIAdapter creates a new HTTP API protocol adapter
func (*HTTPAPIAdapter) Capabilities ¶
func (a *HTTPAPIAdapter) Capabilities() Capabilities
Capabilities returns what this adapter can do
func (*HTTPAPIAdapter) Execute ¶
func (a *HTTPAPIAdapter) Execute(ctx context.Context, operation Operation, config AdapterConfig) (*Result, error)
Execute performs an HTTP API operation
func (*HTTPAPIAdapter) Type ¶
func (a *HTTPAPIAdapter) Type() AdapterType
Type returns the adapter type
func (*HTTPAPIAdapter) Validate ¶
func (a *HTTPAPIAdapter) Validate(config AdapterConfig) error
Validate checks if the configuration is valid
type MockNoSQLConnection ¶
type MockNoSQLConnection struct {
// contains filtered or unexported fields
}
MockNoSQLConnection is a placeholder implementation
func (*MockNoSQLConnection) Close ¶
func (c *MockNoSQLConnection) Close() error
type MongoHandler ¶
type MongoHandler struct{}
MongoHandler handles MongoDB connections
func (*MongoHandler) Connect ¶
func (h *MongoHandler) Connect(ctx context.Context, config AdapterConfig) (NoSQLConnection, error)
func (*MongoHandler) ValidateConfig ¶
func (h *MongoHandler) ValidateConfig(config AdapterConfig) error
type NoSQLAdapter ¶
type NoSQLAdapter struct {
// contains filtered or unexported fields
}
NoSQLAdapter implements the Adapter interface for NoSQL databases
func NewNoSQLAdapter ¶
func NewNoSQLAdapter() *NoSQLAdapter
NewNoSQLAdapter creates a new NoSQL protocol adapter
func (*NoSQLAdapter) Capabilities ¶
func (a *NoSQLAdapter) Capabilities() Capabilities
Capabilities returns what this adapter can do
func (*NoSQLAdapter) Execute ¶
func (a *NoSQLAdapter) Execute(ctx context.Context, operation Operation, config AdapterConfig) (*Result, error)
Execute performs a NoSQL operation
func (*NoSQLAdapter) Validate ¶
func (a *NoSQLAdapter) Validate(config AdapterConfig) error
Validate checks if the configuration is valid
type NoSQLConnection ¶
type NoSQLConnection interface {
Execute(ctx context.Context, command string, params map[string]interface{}) (interface{}, error)
Close() error
}
NoSQLConnection represents a connection to a NoSQL database
type NoSQLHandler ¶
type NoSQLHandler interface {
Connect(ctx context.Context, config AdapterConfig) (NoSQLConnection, error)
ValidateConfig(config AdapterConfig) error
}
NoSQLHandler defines the interface for specific NoSQL database handlers
type Operation ¶
type Operation struct {
// Action is what to do: create, verify, rotate, revoke, list
Action string
// Target identifies what to operate on (e.g., "password", "api-key")
Target string
// Parameters contains operation-specific data
Parameters map[string]interface{}
// Metadata contains additional context
Metadata map[string]string
}
Operation represents a protocol-agnostic operation to perform
type RedisHandler ¶
type RedisHandler struct{}
RedisHandler handles Redis connections
func (*RedisHandler) Connect ¶
func (h *RedisHandler) Connect(ctx context.Context, config AdapterConfig) (NoSQLConnection, error)
func (*RedisHandler) ValidateConfig ¶
func (h *RedisHandler) ValidateConfig(config AdapterConfig) error
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages protocol adapters
func (*Registry) Get ¶
func (r *Registry) Get(adapterType AdapterType) (Adapter, error)
Get retrieves an adapter by type
func (*Registry) GetByProtocol ¶
GetByProtocol retrieves an adapter by protocol string
func (*Registry) List ¶
func (r *Registry) List() []AdapterType
List returns all registered adapter types
type Result ¶
type Result struct {
// Success indicates if the operation succeeded
Success bool
// Data contains operation-specific results
Data map[string]interface{}
// Error message if operation failed
Error string
// Metadata about the operation
Metadata map[string]string
}
Result represents the outcome of a protocol operation
type SQLAdapter ¶
type SQLAdapter struct {
// contains filtered or unexported fields
}
SQLAdapter implements the Adapter interface for SQL databases
func NewSQLAdapter ¶
func NewSQLAdapter() *SQLAdapter
NewSQLAdapter creates a new SQL protocol adapter
func (*SQLAdapter) Capabilities ¶
func (a *SQLAdapter) Capabilities() Capabilities
Capabilities returns what this adapter can do
func (*SQLAdapter) Execute ¶
func (a *SQLAdapter) Execute(ctx context.Context, operation Operation, config AdapterConfig) (*Result, error)
Execute performs a SQL operation
func (*SQLAdapter) Validate ¶
func (a *SQLAdapter) Validate(config AdapterConfig) error
Validate checks if the configuration is valid
type SelfSignedHandler ¶
type SelfSignedHandler struct{}
SelfSignedHandler handles self-signed certificate generation
func (*SelfSignedHandler) GenerateCertificate ¶
func (h *SelfSignedHandler) GenerateCertificate(ctx context.Context, req CertificateRequest, config AdapterConfig) (*CertificateResult, error)
func (*SelfSignedHandler) ListCertificates ¶
func (h *SelfSignedHandler) ListCertificates(ctx context.Context, config AdapterConfig) ([]CertificateInfo, error)
func (*SelfSignedHandler) RevokeCertificate ¶
func (h *SelfSignedHandler) RevokeCertificate(ctx context.Context, serial string, config AdapterConfig) error
func (*SelfSignedHandler) VerifyCertificate ¶
func (h *SelfSignedHandler) VerifyCertificate(ctx context.Context, certPEM []byte, config AdapterConfig) error