Documentation
¶
Index ¶
- Constants
- type AuditEvent
- type Extension
- func (e *Extension) Name() string
- func (e *Extension) OnCertExpiring(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnCertProvisioned(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnDeployFailed(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnDeployRolledBack(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnDeployStarted(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnDeploySucceeded(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnDomainAdded(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnDomainRemoved(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnDomainVerified(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnHealthCheckFailed(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnHealthCheckPassed(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnHealthDegraded(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnHealthRecovered(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnInstanceCreated(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnInstanceDeleted(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnInstanceFailed(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnInstanceScaled(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnInstanceStarted(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnInstanceStopped(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnInstanceSuspended(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnInstanceUnsuspended(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnQuotaExceeded(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnTenantCreated(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnTenantDeleted(ctx context.Context, evt *event.Event) error
- func (e *Extension) OnTenantSuspended(ctx context.Context, evt *event.Event) error
- type Option
- type Recorder
- type RecorderFunc
Constants ¶
const ( SeverityInfo = "info" SeverityWarning = "warning" SeverityCritical = "critical" )
Severity constants.
const ( OutcomeSuccess = "success" OutcomeFailure = "failure" )
Outcome constants.
const ( ActionInstanceCreated = "ctrlplane.instance.created" ActionInstanceStarted = "ctrlplane.instance.started" ActionInstanceStopped = "ctrlplane.instance.stopped" ActionInstanceFailed = "ctrlplane.instance.failed" ActionInstanceDeleted = "ctrlplane.instance.deleted" ActionInstanceScaled = "ctrlplane.instance.scaled" ActionInstanceSuspended = "ctrlplane.instance.suspended" ActionInstanceUnsuspended = "ctrlplane.instance.unsuspended" )
Instance action constants.
const ( ActionDeployStarted = "ctrlplane.deploy.started" ActionDeploySucceeded = "ctrlplane.deploy.succeeded" ActionDeployFailed = "ctrlplane.deploy.failed" ActionDeployRolledBack = "ctrlplane.deploy.rolled_back" )
Deploy action constants.
const ( ActionHealthCheckPassed = "ctrlplane.health.passed" ActionHealthCheckFailed = "ctrlplane.health.failed" ActionHealthDegraded = "ctrlplane.health.degraded" ActionHealthRecovered = "ctrlplane.health.recovered" )
Health action constants.
const ( ActionDomainAdded = "ctrlplane.domain.added" ActionDomainVerified = "ctrlplane.domain.verified" ActionDomainRemoved = "ctrlplane.domain.removed" ActionCertProvisioned = "ctrlplane.cert.provisioned" ActionCertExpiring = "ctrlplane.cert.expiring" )
Network action constants.
const ( ActionTenantCreated = "ctrlplane.tenant.created" ActionTenantSuspended = "ctrlplane.tenant.suspended" ActionTenantDeleted = "ctrlplane.tenant.deleted" ActionQuotaExceeded = "ctrlplane.quota.exceeded" )
Admin action constants.
const ( ResourceInstance = "instance" ResourceDeployment = "deployment" ResourceHealthCheck = "health_check" ResourceDomain = "domain" ResourceCertificate = "certificate" ResourceTenant = "tenant" ResourceQuota = "quota" )
Resource constants.
const ( CategoryInstance = "instance" CategoryDeploy = "deploy" CategoryHealth = "health" CategoryNetwork = "network" CategoryAdmin = "admin" )
Category constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditEvent ¶
type AuditEvent struct {
Action string `json:"action"`
Resource string `json:"resource"`
Category string `json:"category"`
ResourceID string `json:"resource_id,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
Outcome string `json:"outcome"`
Severity string `json:"severity"`
Reason string `json:"reason,omitempty"`
}
AuditEvent mirrors chronicle/audit.Event without a module dependency.
type Extension ¶
type Extension struct {
// contains filtered or unexported fields
}
Extension bridges CtrlPlane lifecycle events to an audit trail backend.
func (*Extension) OnCertExpiring ¶
func (*Extension) OnCertProvisioned ¶
func (*Extension) OnDeployFailed ¶
func (*Extension) OnDeployRolledBack ¶
func (*Extension) OnDeployStarted ¶
func (*Extension) OnDeploySucceeded ¶
func (*Extension) OnDomainAdded ¶
func (*Extension) OnDomainRemoved ¶
func (*Extension) OnDomainVerified ¶
func (*Extension) OnHealthCheckFailed ¶
func (*Extension) OnHealthCheckPassed ¶
func (*Extension) OnHealthDegraded ¶
func (*Extension) OnHealthRecovered ¶
func (*Extension) OnInstanceCreated ¶
func (*Extension) OnInstanceDeleted ¶
func (*Extension) OnInstanceFailed ¶
func (*Extension) OnInstanceScaled ¶
func (*Extension) OnInstanceStarted ¶
func (*Extension) OnInstanceStopped ¶
func (*Extension) OnInstanceSuspended ¶
func (*Extension) OnInstanceUnsuspended ¶
func (*Extension) OnQuotaExceeded ¶
func (*Extension) OnTenantCreated ¶
func (*Extension) OnTenantDeleted ¶
type Option ¶
type Option func(*Extension)
Option configures the audit hook extension.
func WithActions ¶
WithActions limits which audit actions are recorded. By default all actions are recorded. If WithActions is used, only the listed actions will be emitted.
func WithLogger ¶
WithLogger sets a custom logger for the audit hook.
type Recorder ¶
type Recorder interface {
Record(ctx context.Context, event *AuditEvent) error
}
Recorder is the interface that audit backends must implement. Matches chronicle.Emitter but defined locally to avoid the import.
type RecorderFunc ¶
type RecorderFunc func(ctx context.Context, event *AuditEvent) error
RecorderFunc is an adapter to use a plain function as a Recorder.
func (RecorderFunc) Record ¶
func (f RecorderFunc) Record(ctx context.Context, event *AuditEvent) error